Skip to main content

AsyncBufReadExt

Trait AsyncBufReadExt 

Source
pub trait AsyncBufReadExt: AsyncBufRead {
    // Provided methods
    fn read_until<'a>(
        &'a mut self,
        byte: u8,
        buf: &'a mut Vec<u8>,
    ) -> ReadUntil<'a, Self> ⓘ
       where Self: Unpin { ... }
    fn read_line<'a>(&'a mut self, buf: &'a mut String) -> ReadLine<'a, Self> ⓘ
       where Self: Unpin { ... }
    fn lines(self) -> Lines<Self>
       where Self: Sized { ... }
    fn split(self, byte: u8) -> Split<Self>
       where Self: Sized { ... }
    fn fill_buf(&mut self) -> FillBuf<'_, Self> ⓘ
       where Self: Unpin { ... }
    fn consume(&mut self, amount: usize)
       where Self: Unpin { ... }
}
Expand description

Reads on any AsyncBufRead: up to a delimiter, a line, the lines or the segments one by one.

Provided Methods§

Source

fn read_until<'a>( &'a mut self, byte: u8, buf: &'a mut Vec<u8>, ) -> ReadUntil<'a, Self> ⓘ
where Self: Unpin,

Reads up to and including byte (or to the end), appending to buf; answers how many bytes it appended (0 at the end).

Source

fn read_line<'a>(&'a mut self, buf: &'a mut String) -> ReadLine<'a, Self> ⓘ
where Self: Unpin,

Reads up to and including a newline (or to the end), appending to buf if what it read is UTF-8 (an InvalidData error and buf as it was otherwise); answers how many bytes it appended (0 at the end).

Source

fn lines(self) -> Lines<Self>
where Self: Sized,

The lines, without their \n or \r\n, one by one through Lines::next_line.

Source

fn split(self, byte: u8) -> Split<Self>
where Self: Sized,

The segments between bytes, without it, one by one through Split::next_segment.

Source

fn fill_buf(&mut self) -> FillBuf<'_, Self> ⓘ
where Self: Unpin,

The reader’s buffer, filled if it was empty (empty at the end).

Source

fn consume(&mut self, amount: usize)
where Self: Unpin,

Marks amount bytes of the buffer read.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§