Skip to content

Commit df1d9cb

Browse files
committed
Added ?Sized as requirement for reader parameter of poll_read_buf function
1 parent 9c337ca commit df1d9cb

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tokio-util/src/util/poll_buf.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use std::task::{Context, Poll};
4646
/// # }
4747
/// ```
4848
#[cfg_attr(not(feature = "io"), allow(unreachable_pub))]
49-
pub fn poll_read_buf<T: AsyncRead, B: BufMut>(
49+
pub fn poll_read_buf<T: AsyncRead + ?Sized, B: BufMut>(
5050
io: Pin<&mut T>,
5151
cx: &mut Context<'_>,
5252
buf: &mut B,
@@ -143,3 +143,15 @@ pub fn poll_write_buf<T: AsyncWrite, B: Buf>(
143143

144144
Poll::Ready(Ok(n))
145145
}
146+
147+
#[cfg(test)]
148+
mod tests {
149+
150+
fn poll_read(
151+
io: &mut (dyn tokio::io::AsyncRead + Unpin),
152+
cx: &mut std::task::Context<'_>,
153+
buf: &mut impl bytes::BufMut,
154+
) {
155+
let _ = super::poll_read_buf(std::pin::Pin::new(io), cx, buf);
156+
}
157+
}

0 commit comments

Comments
 (0)