diff options
Diffstat (limited to 'src/libstd/old_io/mod.rs')
| -rw-r--r-- | src/libstd/old_io/mod.rs | 36 | 
1 files changed, 21 insertions, 15 deletions
| diff --git a/src/libstd/old_io/mod.rs b/src/libstd/old_io/mod.rs index 6b6c36a31ec..6dfb54fd66c 100644 --- a/src/libstd/old_io/mod.rs +++ b/src/libstd/old_io/mod.rs @@ -49,6 +49,7 @@ //! //! ```rust //! use std::old_io as io; +//! use std::old_io::*; //! //! let mut stdin = io::stdin(); //! for line in stdin.lock().lines() { @@ -59,7 +60,8 @@ //! * Read a complete file //! //! ```rust -//! use std::old_io::File; +//! use std::old_io::*; +//! use std::old_path::Path; //! //! let contents = File::open(&Path::new("message.txt")).read_to_end(); //! ``` @@ -68,7 +70,8 @@ //! //! ```rust //! # #![allow(unused_must_use)] -//! use std::old_io::File; +//! use std::old_io::*; +//! use std::old_path::Path; //! //! let mut file = File::create(&Path::new("message.txt")); //! file.write_all(b"hello, file!\n"); @@ -79,8 +82,8 @@ //! * Iterate over the lines of a file //! //! ```rust,no_run -//! use std::old_io::BufferedReader; -//! use std::old_io::File; +//! use std::old_io::*; +//! use std::old_path::Path; //! //! let path = Path::new("message.txt"); //! let mut file = BufferedReader::new(File::open(&path)); @@ -92,8 +95,8 @@ //! * Pull the lines of a file into a vector of strings //! //! ```rust,no_run -//! use std::old_io::BufferedReader; -//! use std::old_io::File; +//! use std::old_io::*; +//! use std::old_path::Path; //! //! let path = Path::new("message.txt"); //! let mut file = BufferedReader::new(File::open(&path)); @@ -104,7 +107,7 @@ //! //! ```rust //! # #![allow(unused_must_use)] -//! use std::old_io::TcpStream; +//! use std::old_io::*; //! //! # // connection doesn't fail if a server is running on 8080 //! # // locally, we still want to be type checking this code, so lets @@ -122,8 +125,7 @@ //! # fn main() { } //! # fn foo() { //! # #![allow(dead_code)] -//! use std::old_io::{TcpListener, TcpStream}; -//! use std::old_io::{Acceptor, Listener}; +//! use std::old_io::*; //! use std::thread; //! //! let listener = TcpListener::bind("127.0.0.1:80"); @@ -185,7 +187,8 @@ //! //! ```rust //! # #![allow(unused_must_use)] -//! use std::old_io::File; +//! use std::old_io::*; +//! use std::old_path::Path; //! //! match File::create(&Path::new("diary.txt")).write_all(b"Met a girl.\n") { //! Ok(()) => (), // succeeded @@ -218,7 +221,8 @@ //! If you wanted to read several `u32`s from a file and return their product: //! //! ```rust -//! use std::old_io::{File, IoResult}; +//! use std::old_io::*; +//! use std::old_path::Path; //! //! fn file_product(p: &Path) -> IoResult<u32> { //! let mut f = File::open(p); @@ -945,7 +949,7 @@ unsafe fn slice_vec_capacity<'a, T>(v: &'a mut Vec<T>, start: uint, end: uint) - /// /// ``` /// use std::old_io as io; -/// use std::old_io::ByRefReader; +/// use std::old_io::*; /// use std::old_io::util::LimitReader; /// /// fn process_input<R: Reader>(r: R) {} @@ -1279,7 +1283,7 @@ impl<'a> Writer for &'a mut (Writer+'a) { /// /// ``` /// use std::old_io::util::TeeReader; -/// use std::old_io::{stdin, ByRefWriter}; +/// use std::old_io::*; /// /// fn process_input<R: Reader>(r: R) {} /// @@ -1403,7 +1407,7 @@ pub trait Buffer: Reader { /// # Examples /// /// ``` - /// use std::old_io::BufReader; + /// use std::old_io::*; /// /// let mut reader = BufReader::new(b"hello\nworld"); /// assert_eq!("hello\n", &*reader.read_line().unwrap()); @@ -1717,6 +1721,7 @@ pub enum FileType { /// ```no_run /// /// use std::old_io::fs::PathExtensions; +/// use std::old_path::Path; /// /// let info = match Path::new("foo.txt").stat() { /// Ok(stat) => stat, @@ -1845,7 +1850,8 @@ impl fmt::Display for FilePermission { mod tests { use self::BadReaderBehavior::*; use super::{IoResult, Reader, MemReader, NoProgress, InvalidInput, Writer}; - use prelude::v1::{Ok, Vec, Buffer}; + use super::Buffer; + use prelude::v1::{Ok, Vec}; use usize; #[derive(Clone, PartialEq, Debug)] | 
