Struct asynchronous_codec::LinesCodec
source · pub struct LinesCodec;
Expand description
A simple Codec
implementation that splits up data into lines.
use futures::stream::TryStreamExt; // for lines.try_next()
use asynchronous_codec::{FramedRead, LinesCodec};
let input = "hello\nworld\nthis\nis\ndog\n".as_bytes();
let mut lines = FramedRead::new(input, LinesCodec);
while let Some(line) = lines.try_next().await? {
println!("{}", line);
}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LinesCodec
impl RefUnwindSafe for LinesCodec
impl Send for LinesCodec
impl Sync for LinesCodec
impl Unpin for LinesCodec
impl UnwindSafe for LinesCodec
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more