Struct std::old_io::stdio::StdinReaderUnstable
[-] [+]
[src]
pub struct StdinReader { // some fields omitted }
A synchronized wrapper around a buffered reader from stdin
Methods
impl StdinReader
fn lock<'a>(&'a mut self) -> StdinReaderGuard<'a>
Locks the StdinReader
, granting the calling thread exclusive access
to the underlying BufferedReader
.
This provides access to methods like chars
and lines
.
Examples
fn main() { use std::old_io; let mut stdin = old_io::stdin(); for line in stdin.lock().lines() { println!("{}", line.unwrap()); } }use std::old_io; let mut stdin = old_io::stdin(); for line in stdin.lock().lines() { println!("{}", line.unwrap()); }
fn read_line(&mut self) -> IoResult<String>
Like Buffer::read_line
.
The read is performed atomically - concurrent read calls in other threads will not interleave with this one.
fn read_until(&mut self, byte: u8) -> IoResult<Vec<u8>>
Like Buffer::read_until
.
The read is performed atomically - concurrent read calls in other threads will not interleave with this one.
fn read_char(&mut self) -> IoResult<char>
Like Buffer::read_char
.
The read is performed atomically - concurrent read calls in other threads will not interleave with this one.