Struct dup::Dup
[−]
[src]
pub struct Dup;
Dup represents a RW Pipe
Methods
impl Dup
[src]
fn new(fd: c_int) -> (File, File)
new
returns a tuple of Files representing a Read Write Pipe
Arguments
fd
- A file descriptor
Example
// Proxy stdio, logging to your preferred logger and then re-write to the original stdio stream.
`let mut rw = dup::Dup::new(1);
thread::spawn(|| { println!("Hello World"); });
let mut reader = BufReader::new(rw.0); let mut s = String::new(); reader.read_to_string(&mut s); rw.1.write(s.as_bytes());`