Struct std::io::RefWriterExperimental
[-]
[+]
[src]
pub struct RefWriter<'a, W: 'a> { // some fields omitted }
A RefWriter
is a struct implementing Writer
which contains a reference
to another writer. This is often useful when composing streams.
Example
fn main() {} fn process_input<R: Reader>(r: R) {} fn foo () { use std::io::util::TeeReader; use std::io::{stdin, ByRefWriter}; let mut output = Vec::new(); { // Don't give ownership of 'output' to the 'tee'. Instead we keep a // handle to it in the outer scope let mut tee = TeeReader::new(stdin(), output.by_ref()); process_input(tee); } println!("input processed: {}", output); }use std::io::util::TeeReader; use std::io::{stdin, ByRefWriter}; let mut output = Vec::new(); { // Don't give ownership of 'output' to the 'tee'. Instead we keep a // handle to it in the outer scope let mut tee = TeeReader::new(stdin(), output.by_ref()); process_input(tee); } println!("input processed: {}", output);