Struct bytelines::AsyncByteLines
source · [−]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
Auto Trait Implementations
impl<B> RefUnwindSafe for AsyncByteLines<B> where
B: RefUnwindSafe,
impl<B> Send for AsyncByteLines<B> where
B: Send,
impl<B> Sync for AsyncByteLines<B> where
B: Sync,
impl<B> Unpin for AsyncByteLines<B>
impl<B> UnwindSafe for AsyncByteLines<B> where
B: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more