fn read_until<'a>(&'a mut self, byte: u8, buf: &'a mut Vec<u8>) -> ReadUntil<'a, Self>
    where
        Self: Unpin,
    {
        assert_future::<Result<usize>, _>(ReadUntil::new(self, byte, buf))
    }
/// Creates a future which will read all the bytes associated with this I/O
/// object into `buf` until the delimiter `byte` or EOF is reached.
/// This method is the async equivalent to [`BufRead::read_until`](std::io::BufRead::read_until).
///
/// This function will read bytes from the underlying stream until the
/// delimiter or EOF is found. Once found, all bytes up to, and including,
/// the delimiter (if found) will be appended to `buf`.
///
/// The returned future will resolve to the number of bytes read once the read
/// operation is completed.
///
/// In the case of an error the buffer and the object will be discarded, with
/// the error yielded.
///
/// # Examples
///
/// ```
/// # futures::executor::block_on(async {
/// use futures::io::{AsyncBufReadExt, Cursor};
///
/// let mut cursor = Cursor::new(b"lorem-ipsum");
/// let mut buf = vec![];
///
/// // cursor is at 'l'
/// let num_bytes = cursor.read_until(b'-', &mut buf).await?;
/// assert_eq!(num_bytes, 6);
/// assert_eq!(buf, b"lorem-");
/// buf.clear();
///
/// // cursor is at 'i'
/// let num_bytes = cursor.read_until(b'-', &mut buf).await?;
/// assert_eq!(num_bytes, 5);
/// assert_eq!(buf, b"ipsum");
/// buf.clear();
///
/// // cursor is at EOF
/// let num_bytes = cursor.read_until(b'-', &mut buf).await?;
/// assert_eq!(num_bytes, 0);
/// assert_eq!(buf, b"");
/// # Ok::<(), Box<dyn std::error::Error>>(()) }).unwrap();
/// ```
Creates a future which will read all the bytes associated with this I/O
object into `buf` until the delimiter `byte` or EOF is reached.

This function will read bytes from the underlying stream until the
delimiter or EOF is found. Once found, all bytes up to, and including,
the delimiter (if found) will be appended to `buf`.

The returned future will resolve to the number of bytes read once the read
operation is completed.

In the case of an error the buffer and the object will be discarded, with
the error yielded.
Creates a future which will read all the bytes associated with this I / O object into ` buf ` until the delimiter ` byte ` or EOF is reached . This function will read bytes from the underlying stream until the delimiter or EOF is found . Once found all bytes up to and including the delimiter ( if found ) will be appended to ` buf ` . The returned future will resolve to the number of bytes read once the read operation is completed . In the case of an error the buffer and the object will be discarded with the error yielded .
fn read_until<'a>(&'a mut self, byte: u8, buf: &'a mut Vec<u8>) -> ReadUntil<'a, Self>
    where
        Self: Unpin,
    {
        assert_future::<Result<usize>, _>(ReadUntil::new(self, byte, buf))
    }
fn read_until < ' a > ( & ' a mut self , byte : u8 , buf : & ' a mut Vec < u8 > ) -> ReadUntil < ' a , Self > where Self : Unpin , { assert_future :: < Result < usize > , _ > ( ReadUntil :: new ( self , byte , buf ) ) }
Creates a future which will read all the bytes associated with this I/O
object into `buf` until the delimiter `byte` or EOF is reached.
Creates a future which will read all the bytes associated with this I / O object into ` buf ` until the delimiter ` byte ` or EOF is reached .
&'a mut self
byte
u8
buf
&'a mut Vec<u8>
&'a mut self
byte
u8
buf
&'a mut Vec<u8>
examples
None
futures::executor::block_on(async {
use futures::io::{AsyncBufReadExt, Cursor}.

let mut cursor = Cursor::new(b"lorem-ipsum");
let mut buf = vec![].

cursor is at 'l'
let num_bytes = cursor.read_until(b'-', &mut buf).await?;
assert_eq!(num_bytes, 6);
assert_eq!(buf, b"lorem-");
buf.clear().

cursor is at 'i'
let num_bytes = cursor.read_until(b'-', &mut buf).await?;
assert_eq!(num_bytes, 5);
assert_eq!(buf, b"ipsum");
buf.clear().

cursor is at EOF
let num_bytes = cursor.read_until(b'-', &mut buf).await?;
assert_eq!(num_bytes, 0);
assert_eq!(buf, b"").
use futures :: io :: { AsyncBufReadExt Cursor } . let mut cursor = Cursor :: new ( b " lorem - ipsum " ) ; let mut buf = vec! [] . cursor is at ' l ' let num_bytes = cursor . read_until ( b ' - ' &mut buf ) . await? ; assert_eq! ( num_bytes 6 ) ; assert_eq! ( buf b " lorem - " ) ; buf . clear () . cursor is at ' i ' let num_bytes = cursor . read_until ( b ' - ' &mut buf ) . await? ; assert_eq! ( num_bytes 5 ) ; assert_eq! ( buf b " ipsum " ) ; buf . clear () . cursor is at EOF let num_bytes = cursor . read_until ( b ' - ' &mut buf ) . await? ; assert_eq! ( num_bytes 0 ) ; assert_eq! ( buf b " " ) .
ok::<(), box<dyn std::error::error>>(()) }).unwrap();
None