Struct std::old_io::RefReaderUnstable
[-] [+]
[src]
pub struct RefReader<'a, R: 'a> { // some fields omitted }
A RefReader
is a struct implementing Reader
which contains a reference
to another reader. This is often useful when composing streams.
Examples
fn main() { use std::old_io as io; use std::old_io::ByRefReader; use std::old_io::util::LimitReader; fn process_input<R: Reader>(r: R) {} let mut stream = io::stdin(); // Only allow the function to process at most one kilobyte of input { let stream = LimitReader::new(stream.by_ref(), 1024); process_input(stream); } // 'stream' is still available for use here }use std::old_io as io; use std::old_io::ByRefReader; use std::old_io::util::LimitReader; fn process_input<R: Reader>(r: R) {} let mut stream = io::stdin(); // Only allow the function to process at most one kilobyte of input { let stream = LimitReader::new(stream.by_ref(), 1024); process_input(stream); } // 'stream' is still available for use here