Struct std::io::RefReaderExperimental
[-]
[+]
[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.
Example
fn main() {} fn process_input<R: Reader>(r: R) {} fn foo() { use std::io; use std::io::ByRefReader; use std::io::util::LimitReader; 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::io; use std::io::ByRefReader; use std::io::util::LimitReader; 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