Function std::io::empty [] [src]

pub fn empty() -> Empty
1.0.0

Constructs a new handle to an empty reader.

All reads from the returned reader will return Ok(0).

Examples

A slightly sad example of not reading anything into a buffer:

fn main() { use std::io; use std::io::Read; fn foo() -> io::Result<String> { let mut buffer = String::new(); try!(io::empty().read_to_string(&mut buffer)); Ok(buffer) } }
use std::io;
use std::io::Read;

let mut buffer = String::new();
try!(io::empty().read_to_string(&mut buffer));