diff --git a/Cargo.lock b/Cargo.lock index 88d1031..13c866e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,17 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "async-trait" -version = "0.1.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "bitflags" version = "2.10.0" @@ -92,7 +81,6 @@ dependencies = [ name = "http-handler" version = "1.0.0" dependencies = [ - "async-trait", "bytes", "http", "napi", diff --git a/Cargo.toml b/Cargo.toml index face882..c516d59 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,6 @@ napi-support = ["dep:napi", "dep:napi-derive", "dep:napi-build"] napi-build = { version = "2", optional = true } [dependencies] -async-trait = "0.1.88" bytes = "1.10.1" http = "1.0" # http-body = "1.0" diff --git a/src/handler.rs b/src/handler.rs index c105583..c8d241b 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -14,7 +14,6 @@ //! //! struct HelloHandler; //! -//! #[async_trait::async_trait] //! impl Handler for HelloHandler { //! type Error = std::convert::Infallible; //! @@ -41,11 +40,10 @@ //! header_value: &'static str, //! } //! -//! #[async_trait::async_trait] //! impl Handler for AddHeaderHandler //! where //! H: Handler + std::marker::Sync, -//! for<'async_trait> B: std::marker::Send + 'async_trait +//! B: std::marker::Send //! { //! type Error = H::Error; //! @@ -62,7 +60,6 @@ //! // Usage //! struct ApiHandler; //! -//! #[async_trait::async_trait] //! impl Handler for ApiHandler { //! type Error = std::convert::Infallible; //! async fn handle(&self, _req: http::Request) -> Result, Self::Error> { @@ -101,7 +98,6 @@ use bytes::BytesMut; /// /// struct MyHandler; /// -/// #[async_trait::async_trait] /// impl Handler for MyHandler { /// type Error = std::convert::Infallible; /// @@ -122,7 +118,6 @@ use bytes::BytesMut; /// /// struct StringHandler; /// -/// #[async_trait::async_trait] /// impl Handler for StringHandler { /// type Error = std::convert::Infallible; /// @@ -137,7 +132,6 @@ use bytes::BytesMut; /// } /// } /// ``` -#[async_trait::async_trait] pub trait Handler { /// The error type returned by the handler type Error; @@ -157,7 +151,6 @@ mod tests { /// Example handler that echoes the request body pub struct EchoHandler; - #[async_trait::async_trait] impl Handler for EchoHandler { type Error = http::Error; @@ -187,7 +180,6 @@ mod tests { /// Test handler that adds logging struct LoggingHandler; - #[async_trait::async_trait] impl Handler for LoggingHandler { type Error = String; @@ -229,7 +221,6 @@ mod tests { /// Test handler that uses socket info struct SocketAwareHandler; - #[async_trait::async_trait] impl Handler for SocketAwareHandler { type Error = String; @@ -285,7 +276,6 @@ mod tests { /// Test handler that returns errors struct ErrorHandler; - #[async_trait::async_trait] impl Handler for ErrorHandler { type Error = String; @@ -313,7 +303,6 @@ mod tests { /// Test handler that sets an exception struct ExceptionHandler; - #[async_trait::async_trait] impl Handler for ExceptionHandler { type Error = std::convert::Infallible; @@ -351,7 +340,6 @@ mod tests { /// Test handler that works with String bodies struct StringBodyHandler; - #[async_trait::async_trait] impl Handler for StringBodyHandler { type Error = std::convert::Infallible; @@ -430,7 +418,6 @@ mod tests { /// Generic echo handler that works with any cloneable body type pub struct GenericEchoHandler; - #[async_trait::async_trait] impl Handler for GenericEchoHandler { type Error = http::Error; @@ -444,7 +431,6 @@ mod tests { } } - #[async_trait::async_trait] impl Handler> for GenericEchoHandler { type Error = http::Error;