1414//!
1515//! struct HelloHandler;
1616//!
17- //! #[async_trait::async_trait]
1817//! impl Handler for HelloHandler {
1918//! type Error = std::convert::Infallible;
2019//!
4140//! header_value: &'static str,
4241//! }
4342//!
44- //! #[async_trait::async_trait]
4543//! impl<H, B> Handler<B> for AddHeaderHandler<H>
4644//! where
4745//! H: Handler<B> + std::marker::Sync,
48- //! for<'async_trait> B: std::marker::Send + 'async_trait
46+ //! B: std::marker::Send
4947//! {
5048//! type Error = H::Error;
5149//!
6260//! // Usage
6361//! struct ApiHandler;
6462//!
65- //! #[async_trait::async_trait]
6663//! impl Handler for ApiHandler {
6764//! type Error = std::convert::Infallible;
6865//! async fn handle(&self, _req: http::Request<BytesMut>) -> Result<http::Response<BytesMut>, Self::Error> {
@@ -101,7 +98,6 @@ use bytes::BytesMut;
10198///
10299/// struct MyHandler;
103100///
104- /// #[async_trait::async_trait]
105101/// impl Handler for MyHandler {
106102/// type Error = std::convert::Infallible;
107103///
@@ -122,7 +118,6 @@ use bytes::BytesMut;
122118///
123119/// struct StringHandler;
124120///
125- /// #[async_trait::async_trait]
126121/// impl Handler<String> for StringHandler {
127122/// type Error = std::convert::Infallible;
128123///
@@ -137,7 +132,6 @@ use bytes::BytesMut;
137132/// }
138133/// }
139134/// ```
140- #[ async_trait:: async_trait]
141135pub trait Handler < B = BytesMut > {
142136 /// The error type returned by the handler
143137 type Error ;
@@ -157,7 +151,6 @@ mod tests {
157151 /// Example handler that echoes the request body
158152 pub struct EchoHandler ;
159153
160- #[ async_trait:: async_trait]
161154 impl Handler < Bytes > for EchoHandler {
162155 type Error = http:: Error ;
163156
@@ -187,7 +180,6 @@ mod tests {
187180 /// Test handler that adds logging
188181 struct LoggingHandler ;
189182
190- #[ async_trait:: async_trait]
191183 impl Handler < Bytes > for LoggingHandler {
192184 type Error = String ;
193185
@@ -229,7 +221,6 @@ mod tests {
229221 /// Test handler that uses socket info
230222 struct SocketAwareHandler ;
231223
232- #[ async_trait:: async_trait]
233224 impl Handler < Bytes > for SocketAwareHandler {
234225 type Error = String ;
235226
@@ -285,7 +276,6 @@ mod tests {
285276 /// Test handler that returns errors
286277 struct ErrorHandler ;
287278
288- #[ async_trait:: async_trait]
289279 impl Handler < Bytes > for ErrorHandler {
290280 type Error = String ;
291281
@@ -313,7 +303,6 @@ mod tests {
313303 /// Test handler that sets an exception
314304 struct ExceptionHandler ;
315305
316- #[ async_trait:: async_trait]
317306 impl Handler < Bytes > for ExceptionHandler {
318307 type Error = std:: convert:: Infallible ;
319308
@@ -351,7 +340,6 @@ mod tests {
351340 /// Test handler that works with String bodies
352341 struct StringBodyHandler ;
353342
354- #[ async_trait:: async_trait]
355343 impl Handler < String > for StringBodyHandler {
356344 type Error = std:: convert:: Infallible ;
357345
@@ -430,7 +418,6 @@ mod tests {
430418 /// Generic echo handler that works with any cloneable body type
431419 pub struct GenericEchoHandler ;
432420
433- #[ async_trait:: async_trait]
434421 impl Handler < Bytes > for GenericEchoHandler {
435422 type Error = http:: Error ;
436423
@@ -444,7 +431,6 @@ mod tests {
444431 }
445432 }
446433
447- #[ async_trait:: async_trait]
448434 impl Handler < Vec < u8 > > for GenericEchoHandler {
449435 type Error = http:: Error ;
450436
0 commit comments