streamson-futures

Crates.iostreamson-futures
lib.rsstreamson-futures
version7.1.0
sourcesrc
created_at2020-08-29 22:05:43.490962
updated_at2021-05-10 20:19:14.111303
descriptionA library which integrates streamson with futures stream
homepage
repositoryhttps://github.com/shenek/streamson
max_upload_size
id282469
size7,462
Stepan Henek (shenek)

documentation

README

docs.rs

Streamson futures

A library which integrates streamson with futures. It enables to use streamson with async runs

Examples

Wrapping a stream

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));
Commit count: 214

cargo fmt