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);
}