async_std/io/buf_read/
read_until.rs1use std::pin::Pin;
2use std::future::Future;
3
4use super::read_until_internal;
5use crate::io::{self, BufRead};
6use crate::task::{Context, Poll};
7
8#[doc(hidden)]
9#[allow(missing_debug_implementations)]
10pub struct ReadUntilFuture<'a, T: Unpin + ?Sized> {
11 pub(crate) reader: &'a mut T,
12 pub(crate) byte: u8,
13 pub(crate) buf: &'a mut Vec<u8>,
14 pub(crate) read: usize,
15}
16
17impl<T: BufRead + Unpin + ?Sized> Future for ReadUntilFuture<'_, T> {
18 type Output = io::Result<usize>;
19
20 fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
21 let Self {
22 reader,
23 byte,
24 buf,
25 read,
26 } = &mut *self;
27 read_until_internal(Pin::new(reader), cx, *byte, buf, read)
28 }
29}