Skip to content

Commit 86f4983

Browse files
committed
Clean up connect signature
1 parent 62dec59 commit 86f4983

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/server.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ use std::pin::Pin;
1313

1414
use crate::{Body, Exception, MAX_HEADERS};
1515

16-
pub async fn connect<'a, F, Fut, R, W, O: 'a>(
17-
reader: &'a mut R,
18-
writer: &'a mut W,
16+
pub async fn connect<'a, R, W, F, Fut, O>(
17+
reader: R,
18+
mut writer: W,
1919
callback: F,
2020
) -> Result<(), Exception>
2121
where
2222
R: Read + Unpin + Send,
2323
W: Write + Unpin,
24-
F: Fn(&mut Request<Body<BufReader<&'a mut R>>>) -> Fut,
24+
F: Fn(&mut Request<Body<BufReader<R>>>) -> Fut,
2525
Fut: Future<Output = Result<Response<Body<O>>, Exception>>,
2626
O: Read + Unpin + Send,
2727
{
@@ -40,7 +40,7 @@ where
4040

4141
// TODO: what to do when the callback returns Err
4242
let mut res = encode(callback(&mut req).await?).await?;
43-
io::copy(&mut res, writer).await?;
43+
io::copy(&mut res, &mut writer).await?;
4444
let stream = req.into_body().into_reader().into_inner();
4545
req = match timeout(timeout_duration, decode(stream)).await {
4646
Ok(Ok(Some(r))) => r,

0 commit comments

Comments
 (0)