Spawn a new thread that writes to stdout using a Tokio encoder.
This is not production-ready:
- Items that are flushed to the sink are not guaranteed to be written to stdout (eek!)
- Errors are not bubbled up correctly
- The user should be able to limit the size of the BytesMut
- A more thoughful treatment of performance tradeoffs would be nice
```rust extern crate futures; extern crate tokiofmtencoder; extern crate tokioio; extern crate tokiostdout;
use futures::{Future, Stream}; use futures::sync::mpsc::SendError; use futures::stream::iterok; use tokiofmtencoder::DebugEncoder; use tokiostdout::spawnencodersink_bounded;
fn main() {
let encoder: DebugEncoder
iter_ok::<_, SendError<_>>((1..10).into_iter())
.forward(spawn_encoder_sink_bounded(encoder, 1))
.wait()
.unwrap();
} ```
License: MIT/Apache-2.0