runnel
The pluggable io stream. now support: stdio, string io, in memory pipe, in memory line pipe.
Features
- support common operation: stdin, stdout, stderr, stringin, stringout, pipein, pipeout, linepipein and linepipeout.
- thin interface
- support testing io stream
- minimum support rustc 1.60.0 (7737e0b5c 2022-04-04)
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 input stream
let mut lines_iter = sioe.pg_in.lines.map;
assert_eq!;
assert_eq!;
assert_eq!;
// pluggable output stream
let res = sioe.pg_out.lock
.write_fmt;
assert!;
assert_eq!;
// pluggable error stream
let res = sioe.pg_err.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
.pg_out // pluggable pipe out
.build;
let handler = spawn;
// a main thread
let sioe = new
.fill_stringio_with_str
.pg_in // pluggable pipe in
.build;
let mut lines_iter = sioe.pg_in.lines.map;
assert_eq!;
assert_eq!;
assert_eq!;
assert!;
Example of linepipeio :
use RunnelIoeBuilder;
use line_pipe;
use ;
// create in memory line pipe
let = line_pipe;
// a working thread
let sioe = new
.fill_stringio_with_str
.pg_out // pluggable pipe out
.build;
let handler = spawn;
// a main thread
let sioe = new
.fill_stringio_with_str
.pg_in // pluggable pipe in
.build;
let mut lines_iter = sioe.pg_in.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.