runnel
runnel is 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.38.0
Examples
Example of stdio :
use RunnelIoeBuilder;
let sioe = new.build;
Example of stringio :
use RunnelIoeBuilder;
use ;
let sioe = new
.fill_stringio_wit_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_wit_str
.pout // pluggable pipe out
.build;
let handler = spawn;
// a main thread
let sioe = new
.fill_stringio_wit_str
.pin // pluggable pipe in
.build;
let mut lines_iter = sioe.pin.lock.lines.map;
assert_eq!;
assert_eq!;
assert_eq!;
assert!;