Struct std::old_io::RefWriterUnstable [-] [+] [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() { use std::old_io::util::TeeReader; use std::old_io::{stdin, ByRefWriter}; fn process_input<R: Reader>(r: R) {} 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::old_io::util::TeeReader;
use std::old_io::{stdin, ByRefWriter};

fn process_input<R: Reader>(r: R) {}

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);

Trait Implementations

impl<'a, W: Writer> Writer for RefWriter<'a, W>

fn write_all(&mut self, buf: &[u8]) -> IoResult<()>

fn flush(&mut self) -> IoResult<()>

fn write(&mut self, buf: &[u8]) -> IoResult<()>

fn write_fmt(&mut self, fmt: Arguments) -> IoResult<()>

fn write_str(&mut self, s: &str) -> IoResult<()>

fn write_line(&mut self, s: &str) -> IoResult<()>

fn write_char(&mut self, c: char) -> IoResult<()>

fn write_int(&mut self, n: isize) -> IoResult<()>

fn write_uint(&mut self, n: usize) -> IoResult<()>

fn write_le_uint(&mut self, n: usize) -> IoResult<()>

fn write_le_int(&mut self, n: isize) -> IoResult<()>

fn write_be_uint(&mut self, n: usize) -> IoResult<()>

fn write_be_int(&mut self, n: isize) -> IoResult<()>

fn write_be_u64(&mut self, n: u64) -> IoResult<()>

fn write_be_u32(&mut self, n: u32) -> IoResult<()>

fn write_be_u16(&mut self, n: u16) -> IoResult<()>

fn write_be_i64(&mut self, n: i64) -> IoResult<()>

fn write_be_i32(&mut self, n: i32) -> IoResult<()>

fn write_be_i16(&mut self, n: i16) -> IoResult<()>

fn write_be_f64(&mut self, f: f64) -> IoResult<()>

fn write_be_f32(&mut self, f: f32) -> IoResult<()>

fn write_le_u64(&mut self, n: u64) -> IoResult<()>

fn write_le_u32(&mut self, n: u32) -> IoResult<()>

fn write_le_u16(&mut self, n: u16) -> IoResult<()>

fn write_le_i64(&mut self, n: i64) -> IoResult<()>

fn write_le_i32(&mut self, n: i32) -> IoResult<()>

fn write_le_i16(&mut self, n: i16) -> IoResult<()>

fn write_le_f64(&mut self, f: f64) -> IoResult<()>

fn write_le_f32(&mut self, f: f32) -> IoResult<()>

fn write_u8(&mut self, n: u8) -> IoResult<()>

fn write_i8(&mut self, n: i8) -> IoResult<()>