Crate delimiter_slice
source ·Expand description
Stream type for splitting a delimited stream
const TEST: &[u8] = b"FOOBARFOOBARBAZFOO";
const DELIM: &[u8] = b"BAZ";
let stream = ReaderStream::new(TEST);
let mut slice_stream = DelimiterSlice::new(stream, DELIM);
let data = slice_stream.next().await.unwrap().unwrap();
assert_eq!(&data, &TEST[0..12]);
let data = slice_stream.next().await.unwrap().unwrap();
assert_eq!(&data, &TEST[15..]);