diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-12-22 22:33:39 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-12-23 09:10:37 -0800 |
| commit | f9b231cd0884fe90a730d637517c257a4f0c601a (patch) | |
| tree | e886da2ed2d5ca57025853fa1410149941ea179d /src/libstd/io | |
| parent | 316345610a4a34d0c9eda9eece521ebf3cee0fb9 (diff) | |
| download | rust-f9b231cd0884fe90a730d637517c257a4f0c601a.tar.gz rust-f9b231cd0884fe90a730d637517c257a4f0c601a.zip | |
Fixing more doc tests
Diffstat (limited to 'src/libstd/io')
| -rw-r--r-- | src/libstd/io/mod.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 03a656ec2c5..bd0b9e08b7c 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -29,6 +29,7 @@ Some examples of obvious things you might want to do use std::io::buffered::BufferedReader; use std::io::stdin; + # let _g = ::std::io::ignore_io_error(); let mut stdin = BufferedReader::new(stdin()); for line in stdin.lines() { print(line); @@ -40,6 +41,7 @@ Some examples of obvious things you might want to do ```rust use std::io::File; + # let _g = ::std::io::ignore_io_error(); let contents = File::open(&Path::new("message.txt")).read_to_end(); ``` @@ -48,6 +50,7 @@ Some examples of obvious things you might want to do ```rust use std::io::File; + # let _g = ::std::io::ignore_io_error(); let mut file = File::create(&Path::new("message.txt")); file.write(bytes!("hello, file!\n")); ``` @@ -58,6 +61,7 @@ Some examples of obvious things you might want to do use std::io::buffered::BufferedReader; use std::io::File; + # let _g = ::std::io::ignore_io_error(); let path = Path::new("message.txt"); let mut file = BufferedReader::new(File::open(&path)); for line in file.lines() { @@ -71,6 +75,7 @@ Some examples of obvious things you might want to do use std::io::buffered::BufferedReader; use std::io::File; + # let _g = ::std::io::ignore_io_error(); let path = Path::new("message.txt"); let mut file = BufferedReader::new(File::open(&path)); let lines: ~[~str] = file.lines().collect(); @@ -80,10 +85,11 @@ Some examples of obvious things you might want to do XXX This needs more improvement: TcpStream constructor taking &str, `write_str` and `write_line` methods. - ```rust,ignore + ```rust,should_fail use std::io::net::ip::SocketAddr; use std::io::net::tcp::TcpStream; + # let _g = ::std::io::ignore_io_error(); let addr = from_str::<SocketAddr>("127.0.0.1:8080").unwrap(); let mut socket = TcpStream::connect(addr).unwrap(); socket.write(bytes!("GET / HTTP/1.0\n\n")); |
