From 84d43e81705f1edb22bcdd1079585bbe90f89df6 Mon Sep 17 00:00:00 2001 From: ivmarkov Date: Tue, 10 Oct 2023 20:43:49 +0000 Subject: [PATCH] Compat with latest embedded-svc --- Cargo.toml | 5 ++--- examples/http_server.rs | 19 ------------------- src/asynch/http/server.rs | 19 ------------------- src/lib.rs | 17 +++++------------ 4 files changed, 7 insertions(+), 53 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c8917f4..2997fe6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,15 +2,14 @@ name = "edge-net" version = "0.3.0" authors = ["Ivan Markov "] -edition = "2018" -resolver = "2" +edition = "2021" categories = ["embedded", "hardware-support"] keywords = ["embedded", "svc", "network"] description = "no_std and no-alloc async implementations of various network protocols." repository = "https://github.com/ivmarkov/edge-net" license = "MIT OR Apache-2.0" readme = "README.md" -rust-version = "1.67" +rust-version = "1.70" [patch.crates-io] embedded-svc = { git = "https://github.com/esp-rs/embedded-svc" } diff --git a/examples/http_server.rs b/examples/http_server.rs index b87fd93..a7e10fd 100644 --- a/examples/http_server.rs +++ b/examples/http_server.rs @@ -84,7 +84,6 @@ impl SimpleHandler { } } -#[cfg(version("1.67"))] impl<'b, const N: usize, T> Handler<'b, N, T> for SimpleHandler where T: Read + Write, @@ -98,21 +97,3 @@ where SimpleHandler::handle(self, path, method, connection).await } } - -#[cfg(not(version("1.67")))] -impl<'b, const N: usize, T> Handler<'b, N, T> for SimpleHandler -where - T: Read + Write, -{ - type HandleFuture<'a> = impl core::future::Future> + 'a - where Self: 'a, 'b: 'a, T: 'a; - - fn handle<'a>( - &'a self, - path: &'a str, - method: Method, - connection: &'a mut ServerConnection<'b, N, T>, - ) -> Self::HandleFuture<'a> { - SimpleHandler::handle(self, path, method, connection) - } -} diff --git a/src/asynch/http/server.rs b/src/asynch/http/server.rs index 0064e07..09e0bd6 100644 --- a/src/asynch/http/server.rs +++ b/src/asynch/http/server.rs @@ -260,7 +260,6 @@ pub struct RequestState<'b, const N: usize, T> { pub type ResponseState = SendBody; -#[cfg(version("1.67"))] pub trait Handler<'b, const N: usize, T> { async fn handle<'a>( &'a self, @@ -270,24 +269,6 @@ pub trait Handler<'b, const N: usize, T> { ) -> Result<(), HandlerError>; } -// Does not typecheck with latest nightly 1.67 -// See https://github.com/rust-lang/rust/issues/104691 -#[cfg(not(version("1.67")))] -pub trait Handler<'b, const N: usize, T> { - type HandleFuture<'a>: Future> - where - Self: 'a, - 'b: 'a, - T: 'a; - - fn handle<'a>( - &'a self, - path: &'a str, - method: Method, - connection: &'a mut ServerConnection<'b, N, T>, - ) -> Self::HandleFuture<'a>; -} - pub async fn handle_connection( mut io: T, handler_id: usize, diff --git a/src/lib.rs b/src/lib.rs index 5946634..7f9e427 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,17 +1,10 @@ #![cfg_attr(not(feature = "std"), no_std)] #![allow(stable_features)] -#![feature(cfg_version)] -#![cfg_attr(feature = "nightly", feature(type_alias_impl_trait))] -#![cfg_attr( - all(feature = "nightly", version("1.70")), - feature(impl_trait_in_assoc_type) -)] -#![cfg_attr( - feature = "nightly", - feature(async_fn_in_trait), - feature(impl_trait_projections), - allow(incomplete_features) -)] +#![allow(unknown_lints)] +#![cfg_attr(feature = "nightly", feature(async_fn_in_trait))] +#![cfg_attr(feature = "nightly", allow(async_fn_in_trait))] +#![cfg_attr(feature = "nightly", feature(impl_trait_projections))] +#![cfg_attr(feature = "nightly", feature(impl_trait_in_assoc_type))] #[cfg(feature = "nightly")] pub mod asynch;