11 stable releases
7.1.0 | May 10, 2021 |
---|---|
7.0.1 | Apr 15, 2021 |
6.3.1 | Dec 8, 2020 |
6.2.0 | Nov 12, 2020 |
5.0.2 | Oct 10, 2020 |
#326 in FFI
75 downloads per month
245KB
5.5K
SLoC
Streamson generator
A library which integrates streamson with rust generators.
Examples
Use file for input generator
let mut file = fs::File::open("/tmp/large.json")?;
let mut input_generator = move || {
loop {
let mut buffer = vec![0; 2048];
if file.read(&mut buffer).unwrap() == 0 {
break;
}
yield buffer;
}
};
let matcher = Box::new(Simple::from_str(r#"{"users"}[]{"name"}"#).unwrap());
let mut output_generator = StreamsonGenerator::new(input_generator, matcher);
for item in output_generator {
match item {
Ok((path, data)) => {
// Do something with the data
},
Err(err) => {
// Deal with error situation
}
}
}
lib.rs
:
Library which integrates streamson-lib
with rust generators