|  | 
| 110 | 110 | //! something like this: | 
| 111 | 111 | //! | 
| 112 | 112 | //! ```{.ignore} | 
| 113 |  | -//! use std::old_io::{File, Open, Write}; | 
|  | 113 | +//! use std::old_io::*; | 
|  | 114 | +//! use std::old_path::Path; | 
| 114 | 115 | //! | 
| 115 | 116 | //! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write); | 
| 116 | 117 | //! // If `write_line` errors, then we'll never know, because the return | 
|  | 
| 128 | 129 | //! a marginally useful message indicating why: | 
| 129 | 130 | //! | 
| 130 | 131 | //! ```{.no_run} | 
| 131 |  | -//! use std::old_io::{File, Open, Write}; | 
|  | 132 | +//! use std::old_io::*; | 
|  | 133 | +//! use std::old_path::Path; | 
| 132 | 134 | //! | 
| 133 | 135 | //! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write); | 
| 134 | 136 | //! file.write_line("important message").ok().expect("failed to write message"); | 
|  | 
| 138 | 140 | //! You might also simply assert success: | 
| 139 | 141 | //! | 
| 140 | 142 | //! ```{.no_run} | 
| 141 |  | -//! # use std::old_io::{File, Open, Write}; | 
|  | 143 | +//! # use std::old_io::*; | 
|  | 144 | +//! # use std::old_path::Path; | 
| 142 | 145 | //! | 
| 143 | 146 | //! # let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write); | 
| 144 | 147 | //! assert!(file.write_line("important message").is_ok()); | 
|  | 
| 148 | 151 | //! Or propagate the error up the call stack with `try!`: | 
| 149 | 152 | //! | 
| 150 | 153 | //! ``` | 
| 151 |  | -//! # use std::old_io::{File, Open, Write, IoError}; | 
|  | 154 | +//! # use std::old_io::*; | 
|  | 155 | +//! # use std::old_path::Path; | 
| 152 | 156 | //! fn write_message() -> Result<(), IoError> { | 
| 153 | 157 | //!     let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write); | 
| 154 | 158 | //!     try!(file.write_line("important message")); | 
|  | 
| 167 | 171 | //! It replaces this: | 
| 168 | 172 | //! | 
| 169 | 173 | //! ``` | 
| 170 |  | -//! use std::old_io::{File, Open, Write, IoError}; | 
|  | 174 | +//! use std::old_io::*; | 
|  | 175 | +//! use std::old_path::Path; | 
| 171 | 176 | //! | 
| 172 | 177 | //! struct Info { | 
| 173 | 178 | //!     name: String, | 
|  | 
| 191 | 196 | //! With this: | 
| 192 | 197 | //! | 
| 193 | 198 | //! ``` | 
| 194 |  | -//! use std::old_io::{File, Open, Write, IoError}; | 
|  | 199 | +//! use std::old_io::*; | 
|  | 200 | +//! use std::old_path::Path; | 
| 195 | 201 | //! | 
| 196 | 202 | //! struct Info { | 
| 197 | 203 | //!     name: String, | 
| @@ -446,7 +452,7 @@ impl<T, E> Result<T, E> { | 
| 446 | 452 |     /// ignoring I/O and parse errors: | 
| 447 | 453 |     /// | 
| 448 | 454 |     /// ``` | 
| 449 |  | -    /// use std::old_io::IoResult; | 
|  | 455 | +    /// use std::old_io::*; | 
| 450 | 456 |     /// | 
| 451 | 457 |     /// let mut buffer: &[u8] = b"1\n2\n3\n4\n"; | 
| 452 | 458 |     /// let mut buffer = &mut buffer; | 
|  | 
0 commit comments