mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-09 00:00:08 +02:00
io: drop the Sized requirements from AsyncReadExt.read_buf (#6169)
This commit is contained in:
@@ -245,8 +245,8 @@ cfg_io_util! {
|
|||||||
/// ```
|
/// ```
|
||||||
fn read_buf<'a, B>(&'a mut self, buf: &'a mut B) -> ReadBuf<'a, Self, B>
|
fn read_buf<'a, B>(&'a mut self, buf: &'a mut B) -> ReadBuf<'a, Self, B>
|
||||||
where
|
where
|
||||||
Self: Sized + Unpin,
|
Self: Unpin,
|
||||||
B: BufMut,
|
B: BufMut + ?Sized,
|
||||||
{
|
{
|
||||||
read_buf(self, buf)
|
read_buf(self, buf)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ use std::task::{Context, Poll};
|
|||||||
|
|
||||||
pub(crate) fn read_buf<'a, R, B>(reader: &'a mut R, buf: &'a mut B) -> ReadBuf<'a, R, B>
|
pub(crate) fn read_buf<'a, R, B>(reader: &'a mut R, buf: &'a mut B) -> ReadBuf<'a, R, B>
|
||||||
where
|
where
|
||||||
R: AsyncRead + Unpin,
|
R: AsyncRead + Unpin + ?Sized,
|
||||||
B: BufMut,
|
B: BufMut + ?Sized,
|
||||||
{
|
{
|
||||||
ReadBuf {
|
ReadBuf {
|
||||||
reader,
|
reader,
|
||||||
@@ -24,7 +24,7 @@ pin_project! {
|
|||||||
/// Future returned by [`read_buf`](crate::io::AsyncReadExt::read_buf).
|
/// Future returned by [`read_buf`](crate::io::AsyncReadExt::read_buf).
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||||
pub struct ReadBuf<'a, R, B> {
|
pub struct ReadBuf<'a, R: ?Sized, B: ?Sized> {
|
||||||
reader: &'a mut R,
|
reader: &'a mut R,
|
||||||
buf: &'a mut B,
|
buf: &'a mut B,
|
||||||
#[pin]
|
#[pin]
|
||||||
@@ -34,8 +34,8 @@ pin_project! {
|
|||||||
|
|
||||||
impl<R, B> Future for ReadBuf<'_, R, B>
|
impl<R, B> Future for ReadBuf<'_, R, B>
|
||||||
where
|
where
|
||||||
R: AsyncRead + Unpin,
|
R: AsyncRead + Unpin + ?Sized,
|
||||||
B: BufMut,
|
B: BufMut + ?Sized,
|
||||||
{
|
{
|
||||||
type Output = io::Result<usize>;
|
type Output = io::Result<usize>;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user