Skip to content

Commit c9df37f

Browse files
committed
Small clean up
1 parent 228bc64 commit c9df37f

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

examples/server.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async fn accept(addr: String, stream: TcpStream) -> Result<(), async_h1::Excepti
1717
let stream = Stream(Arc::new(stream));
1818

1919
server::accept(&addr, stream.clone(), stream, |req| {
20-
async move {
20+
async move {
2121
dbg!(req.method());
2222
let mut resp = Response::new(StatusCode::Ok);
2323
resp.insert_header(
@@ -30,12 +30,9 @@ async fn accept(addr: String, stream: TcpStream) -> Result<(), async_h1::Excepti
3030
// 0x48u8, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x21,
3131
// ]));
3232
Ok(resp)
33-
}
34-
}).await
35-
}
36-
37-
struct Request<'a, T: Read> {
38-
body: Pin<Box<&'a T>> // this can be a TcpStream.
33+
}
34+
})
35+
.await
3936
}
4037

4138
fn main() -> Result<(), async_h1::Exception> {

src/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ pub async fn accept<R, W, F, Fut>(
2626
endpoint: F,
2727
) -> Result<(), Exception>
2828
where
29-
R: Read + Unpin + Send + Sync + 'static + Clone,
29+
R: Read + Unpin + Send + 'static + Clone,
3030
W: Write + Unpin,
31-
F: for<'a> Fn(Request) -> Fut,
31+
F: Fn(Request) -> Fut,
3232
Fut: Future<Output = Result<Response, Exception>>,
3333
{
3434
// TODO: make configurable

0 commit comments

Comments
 (0)