18 stable releases (7 major)

7.1.0 May 10, 2021
6.3.1 Dec 8, 2020
6.2.0 Nov 12, 2020
5.0.2 Oct 10, 2020
0.2.0 May 29, 2020

#2143 in Parser implementations

MIT license

240KB
5.5K SLoC

docs.rs

Streamson tokio

A library which integrates streamson with tokio. So that you can easily process JSONs using asynchronous rust.

Examples

Reading a large file

 use std::io;
 use streamson_lib::{error, matcher};
 use streamson_tokio::decoder::Extractor;
 use tokio::{fs, stream::StreamExt};
 use tokio_util::codec::FramedRead;

 let mut file = fs::File::open("/tmp/large.json").await?;
 let matcher = matcher::Combinator::new(matcher::Simple::new(r#"{"users"}[]"#).unwrap())
     | matcher::Combinator::new(matcher::Simple::new(r#"{"groups"}[]"#).unwrap());
 let extractor = Extractor::new(matcher);
 let mut output = FramedRead::new(file, extractor);
 while let Some(item) = output.next().await {
     let (path, data) = item?;
     // Do something with extracted data
 }

lib.rs:

Library which integrates streamson-lib into tokio

Dependencies

~4MB
~56K SLoC