Crates.io | tokio-stdout |
lib.rs | tokio-stdout |
version | 0.1.0 |
source | src |
created_at | 2017-10-20 00:20:49.679532 |
updated_at | 2017-10-20 00:20:49.679532 |
description | Write to stdout as a Tokio sink |
homepage | |
repository | https://github.com/paulkernfeld/tokio-stdout |
max_upload_size | |
id | 36273 |
size | 6,412 |
Spawn a new thread that writes to stdout using a Tokio encoder.
This is not production-ready:
BytesMut
extern crate futures;
extern crate tokio_fmt_encoder;
extern crate tokio_io;
extern crate tokio_stdout;
use futures::{Future, Stream};
use futures::sync::mpsc::SendError;
use futures::stream::iter_ok;
use tokio_fmt_encoder::DebugEncoder;
use tokio_stdout::spawn_encoder_sink_bounded;
fn main() {
let encoder: DebugEncoder<usize> = Default::default();
iter_ok::<_, SendError<_>>((1..10).into_iter())
.forward(spawn_encoder_sink_bounded(encoder, 1))
.wait()
.unwrap();
}
License: MIT/Apache-2.0