Crates.io | streamson-futures |
lib.rs | streamson-futures |
version | 7.1.0 |
source | src |
created_at | 2020-08-29 22:05:43.490962 |
updated_at | 2021-05-10 20:19:14.111303 |
description | A library which integrates streamson with futures stream |
homepage | |
repository | https://github.com/shenek/streamson |
max_upload_size | |
id | 282469 |
size | 7,462 |
A library which integrates streamson with futures. It enables to use streamson with async runs
use bytes::Bytes;
use futures::stream::{self, StreamExt};
use streamson_lib::matcher;
use streamson_futures::stream::BufferStream;
let stream = stream::iter(
vec![r#"{"users": ["#, r#"{"name": "carl", "id": 1}"#, r#"]}"#]
.drain(..)
.map(Bytes::from)
.collect::<Vec<Bytes>>()
);
let matcher = matcher::Simple::new(r#"{"users"}[]{"name"}"#).unwrap();
let wrapped_stream = BufferStream::new(stream, Box::new(matcher));