decode a byte stream of varint length-encoded messages into a stream of chunks
This crate is similar to and compatible with the javascript length-prefixed-stream package.
``` rust
use asyncstd::{prelude::*,stream,task};
use lengthprefixed_stream::decode;
use futures::{stream::TryStreamExt};
type Error = Box
// this program will print: // [97,98,99,100,101,102] // [65,66,67,68]
fn main() -> Result<(),Error> { task::blockon(async { let input = stream::fromiter(vec![ Ok(vec![6,97,98,99]), Ok(vec![100,101]), Ok(vec![102,4,65,66]), Ok(vec![67,68]), ]).intoasyncread(); let mut decoder = decode(input); while let Some(chunk) = decoder.next().await { println!["{:?}", chunk?]; } Ok(()) }) } ```