pub struct AsyncByteLines<B> where
    B: AsyncBufRead + Unpin
{ /* private fields */ }
Expand description

Provides async iteration over bytes of input, split by line.

use bytelines::*;
use std::fs::File;
use std::io::BufReader;

// construct our iterator from our file input
let file = File::open("./res/numbers.txt").await?;
let reader = BufReader::new(file);
let mut lines = AsyncByteLines::new(reader);

// walk our lines using `while` syntax
while let Some(line) = lines.next().await? {
    // do something with the line, which is &[u8]
}

This differs from the `stdlib` version of the API as it fits
more closely with the Tokio API for types. There is no current
`Stream` based API for this form as of yet.

Implementations

Constructs a new ByteLines from an input AsyncBufRead.

Retrieves a reference to the next line of bytes in the reader (if any).

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.