runnel
The pluggable io stream. now support: stdio, string io, in memory pipe.
Features
- support common operation: stdin, stdout, stderr, stringin, stringout, pipein and pipeout.
- thin interface
- support testing stream io
- minimum support rustc 1.57.0 (f1edd0429 2021-11-29)
Examples
Example of stdio :
use RunnelIoeBuilder;
let sioe = new.build;
Example of stringio :
use RunnelIoeBuilder;
use ;
let sioe = new
.fill_stringio_with_str
.build;
// pluggable stream in
let mut lines_iter = sioe.pin.lock.lines.map;
assert_eq!;
assert_eq!;
assert_eq!;
// pluggable stream out
let res = sioe.pout.lock
.write_fmt;
assert!;
assert_eq!;
// pluggable stream err
let res = sioe.perr.lock
.write_fmt;
assert!;
assert_eq!;
Example of pipeio :
use RunnelIoeBuilder;
use pipe;
use ;
// create in memory pipe
let = pipe;
// a working thread
let sioe = new
.fill_stringio_with_str
.pout // pluggable pipe out
.build;
let handler = spawn;
// a main thread
let sioe = new
.fill_stringio_with_str
.pin // pluggable pipe in
.build;
let mut lines_iter = sioe.pin.lock.lines.map;
assert_eq!;
assert_eq!;
assert_eq!;
assert!;
Changelogs
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.