diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-11-10 22:46:32 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-11-11 20:44:07 -0800 |
| commit | 49ee49296b65f3d807142f3326bee71dd7e13290 (patch) | |
| tree | b3380df09c8a10473820969a62f5775832255fda /src/libstd | |
| parent | 8b4683d79d4b74f53808470cd2f98b23a0af9b93 (diff) | |
| download | rust-49ee49296b65f3d807142f3326bee71dd7e13290.tar.gz rust-49ee49296b65f3d807142f3326bee71dd7e13290.zip | |
Move std::rt::io to std::io
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/fmt/mod.rs | 10 | ||||
| -rw-r--r-- | src/libstd/hash.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/buffered.rs (renamed from src/libstd/rt/io/buffered.rs) | 5 | ||||
| -rw-r--r-- | src/libstd/io/comm_adapters.rs (renamed from src/libstd/rt/io/comm_adapters.rs) | 0 | ||||
| -rw-r--r-- | src/libstd/io/extensions.rs (renamed from src/libstd/rt/io/extensions.rs) | 7 | ||||
| -rw-r--r-- | src/libstd/io/flate.rs (renamed from src/libstd/rt/io/flate.rs) | 0 | ||||
| -rw-r--r-- | src/libstd/io/fs.rs (renamed from src/libstd/rt/io/fs.rs) | 41 | ||||
| -rw-r--r-- | src/libstd/io/mem.rs (renamed from src/libstd/rt/io/mem.rs) | 2 | ||||
| -rw-r--r-- | src/libstd/io/mod.rs (renamed from src/libstd/rt/io/mod.rs) | 12 | ||||
| -rw-r--r-- | src/libstd/io/native/file.rs (renamed from src/libstd/rt/io/native/file.rs) | 10 | ||||
| -rw-r--r-- | src/libstd/io/native/process.rs (renamed from src/libstd/rt/io/native/process.rs) | 2 | ||||
| -rw-r--r-- | src/libstd/io/native/stdio.rs (renamed from src/libstd/rt/io/native/stdio.rs) | 2 | ||||
| -rw-r--r-- | src/libstd/io/net/addrinfo.rs (renamed from src/libstd/rt/io/net/addrinfo.rs) | 7 | ||||
| -rw-r--r-- | src/libstd/io/net/ip.rs (renamed from src/libstd/rt/io/net/ip.rs) | 6 | ||||
| -rw-r--r-- | src/libstd/io/net/mod.rs (renamed from src/libstd/rt/io/net/mod.rs) | 0 | ||||
| -rw-r--r-- | src/libstd/io/net/tcp.rs (renamed from src/libstd/rt/io/net/tcp.rs) | 40 | ||||
| -rw-r--r-- | src/libstd/io/net/udp.rs (renamed from src/libstd/rt/io/net/udp.rs) | 12 | ||||
| -rw-r--r-- | src/libstd/io/net/unix.rs (renamed from src/libstd/rt/io/net/unix.rs) | 10 | ||||
| -rw-r--r-- | src/libstd/io/option.rs (renamed from src/libstd/rt/io/option.rs) | 0 | ||||
| -rw-r--r-- | src/libstd/io/pipe.rs (renamed from src/libstd/rt/io/pipe.rs) | 6 | ||||
| -rw-r--r-- | src/libstd/io/process.rs (renamed from src/libstd/rt/io/process.rs) | 4 | ||||
| -rw-r--r-- | src/libstd/io/signal.rs (renamed from src/libstd/rt/io/signal.rs) | 11 | ||||
| -rw-r--r-- | src/libstd/io/stdio.rs (renamed from src/libstd/rt/io/stdio.rs) | 4 | ||||
| -rw-r--r-- | src/libstd/io/timer.rs (renamed from src/libstd/rt/io/timer.rs) | 6 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 6 | ||||
| -rw-r--r-- | src/libstd/os.rs | 6 | ||||
| -rw-r--r-- | src/libstd/prelude.rs | 4 | ||||
| -rw-r--r-- | src/libstd/rand/os.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rand/reader.rs | 6 | ||||
| -rw-r--r-- | src/libstd/repr.rs | 8 | ||||
| -rw-r--r-- | src/libstd/rt/logging.rs | 6 | ||||
| -rw-r--r-- | src/libstd/rt/mod.rs | 6 | ||||
| -rw-r--r-- | src/libstd/rt/rtio.rs | 24 | ||||
| -rw-r--r-- | src/libstd/rt/sched.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rt/task.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rt/test.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rt/util.rs | 4 | ||||
| -rw-r--r-- | src/libstd/run.rs | 12 | ||||
| -rw-r--r-- | src/libstd/to_bytes.rs | 4 |
39 files changed, 152 insertions, 141 deletions
diff --git a/src/libstd/fmt/mod.rs b/src/libstd/fmt/mod.rs index 9d5c9c1a5cd..a48b8578116 100644 --- a/src/libstd/fmt/mod.rs +++ b/src/libstd/fmt/mod.rs @@ -220,7 +220,7 @@ currently implemented are: ```rust format! // described above -write! // first argument is a &mut rt::io::Writer, the destination +write! // first argument is a &mut io::Writer, the destination writeln! // same as write but appends a newline print! // the format string is printed to the standard output println! // same as print but appends a newline @@ -236,7 +236,7 @@ strings and instead directly write the output. Under the hood, this function is actually invoking the `write` function defined in this module. Example usage is: ```rust -use std::rt::io; +use std::io; let mut w = io::mem::MemWriter::new(); write!(&mut w as &mut io::Writer, "Hello {}!", "world"); @@ -462,9 +462,9 @@ use prelude::*; use cast; use char::Char; -use rt::io::Decorator; -use rt::io::mem::MemWriter; -use rt::io; +use io::Decorator; +use io::mem::MemWriter; +use io; use str; use repr; use util; diff --git a/src/libstd/hash.rs b/src/libstd/hash.rs index 6f6e847f569..c9a85e6d25e 100644 --- a/src/libstd/hash.rs +++ b/src/libstd/hash.rs @@ -29,7 +29,7 @@ use container::Container; use iter::Iterator; use option::{Some, None}; -use rt::io::Writer; +use io::Writer; use str::OwnedStr; use to_bytes::IterBytes; use vec::ImmutableVector; diff --git a/src/libstd/rt/io/buffered.rs b/src/libstd/io/buffered.rs index 8afb7183d77..4932f392090 100644 --- a/src/libstd/rt/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -349,6 +349,7 @@ impl<S: Stream> Decorator<S> for BufferedStream<S> { mod test { use prelude::*; use super::*; + use io; use super::super::mem::{MemReader, MemWriter}; #[test] @@ -427,11 +428,11 @@ mod test { use rt; struct S; - impl rt::io::Writer for S { + impl io::Writer for S { fn write(&mut self, _: &[u8]) {} } - impl rt::io::Reader for S { + impl io::Reader for S { fn read(&mut self, _: &mut [u8]) -> Option<uint> { None } fn eof(&mut self) -> bool { true } } diff --git a/src/libstd/rt/io/comm_adapters.rs b/src/libstd/io/comm_adapters.rs index 98dbec27fb9..98dbec27fb9 100644 --- a/src/libstd/rt/io/comm_adapters.rs +++ b/src/libstd/io/comm_adapters.rs diff --git a/src/libstd/rt/io/extensions.rs b/src/libstd/io/extensions.rs index 261792977b3..ebda2618dcf 100644 --- a/src/libstd/rt/io/extensions.rs +++ b/src/libstd/io/extensions.rs @@ -15,7 +15,7 @@ use iter::Iterator; use option::Option; -use rt::io::{Reader, Decorator}; +use io::{Reader, Decorator}; /// An iterator that reads a single byte on each iteration, /// until `.read_byte()` returns `None`. @@ -139,8 +139,9 @@ pub fn u64_from_be_bytes(data: &[u8], #[cfg(test)] mod test { use option::{None, Option, Some}; - use rt::io::mem::{MemReader, MemWriter}; - use rt::io::{Reader, io_error, placeholder_error}; + use io::mem::{MemReader, MemWriter}; + use io::{Reader, io_error, placeholder_error}; + use vec::ImmutableVector; struct InitialZeroByteReader { count: int, diff --git a/src/libstd/rt/io/flate.rs b/src/libstd/io/flate.rs index 8a5aa171eb8..8a5aa171eb8 100644 --- a/src/libstd/rt/io/flate.rs +++ b/src/libstd/io/flate.rs diff --git a/src/libstd/rt/io/fs.rs b/src/libstd/io/fs.rs index 06c07308cf6..d5514eb14d3 100644 --- a/src/libstd/rt/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -17,7 +17,7 @@ At the top-level of the module are a set of freestanding functions, associated with various filesystem operations. They all operate on a `Path` object. All operations in this module, including those as part of `File` et al -block the task during execution. Most will raise `std::rt::io::io_error` +block the task during execution. Most will raise `std::io::io_error` conditions in the event of failure. Also included in this module is an implementation block on the `Path` object @@ -27,7 +27,7 @@ particular bits of it, etc. # Example - use std::rt::io::{File, fs}; + use std::io::{File, fs}; let path = Path::new("foo.txt"); @@ -46,17 +46,18 @@ particular bits of it, etc. */ use c_str::ToCStr; +use clone::Clone; use iter::Iterator; use super::{Reader, Writer, Seek}; use super::{SeekStyle, Read, Write, Open, IoError, Truncate, FileMode, FileAccess, FileStat, io_error, FilePermission}; use rt::rtio::{RtioFileStream, IoFactory, with_local_io}; -use rt::io; +use io; use option::{Some, None, Option}; use result::{Ok, Err, Result}; use path; use path::{Path, GenericPath}; -use vec::OwnedVector; +use vec::{OwnedVector, ImmutableVector}; /// Unconstrained file access type that exposes read and write operations /// @@ -92,7 +93,7 @@ impl File { /// /// # Example /// - /// use std::rt::io::{File, io_error, Open, ReadWrite}; + /// use std::io::{File, io_error, Open, ReadWrite}; /// /// let p = Path::new("/some/file/path.txt"); /// @@ -111,7 +112,7 @@ impl File { /// /// `FileMode` and `FileAccess` provide information about the permissions /// context in which a given stream is created. More information about them - /// can be found in `std::rt::io`'s docs. If a file is opened with `Write` + /// can be found in `std::io`'s docs. If a file is opened with `Write` /// or `ReadWrite` access, then it will be created it it does not already /// exist. /// @@ -154,7 +155,7 @@ impl File { /// /// # Example /// - /// use std::rt::io::File; + /// use std::io::File; /// /// let contents = File::open(&Path::new("foo.txt")).read_to_end(); pub fn open(path: &Path) -> Option<File> { @@ -169,7 +170,7 @@ impl File { /// /// # Example /// - /// use std::rt::io::File; + /// use std::io::File; /// /// let mut f = File::create(&Path::new("foo.txt")); /// f.write(bytes!("This is a sample file")); @@ -226,7 +227,7 @@ impl File { /// /// # Example /// -/// use std::rt::io::fs; +/// use std::io::fs; /// /// let p = Path::new("/some/file/path.txt"); /// fs::unlink(&p); @@ -256,8 +257,8 @@ pub fn unlink(path: &Path) { /// /// # Example /// -/// use std::rt::io; -/// use std::rt::io::fs; +/// use std::io; +/// use std::io::fs; /// /// let p = Path::new("/some/file/path.txt"); /// match io::result(|| fs::stat(&p)) { @@ -318,7 +319,7 @@ pub fn lstat(path: &Path) -> FileStat { /// /// # Example /// -/// use std::rt::io::fs; +/// use std::io::fs; /// /// fs::rename(&Path::new("foo"), &Path::new("bar")); /// // Oh boy, nothing was raised! @@ -342,7 +343,7 @@ pub fn rename(from: &Path, to: &Path) { /// /// # Example /// -/// use std::rt::io::fs; +/// use std::io::fs; /// /// fs::copy(&Path::new("foo.txt"), &Path::new("bar.txt")); /// // Oh boy, nothing was raised! @@ -388,8 +389,8 @@ pub fn copy(from: &Path, to: &Path) { /// /// # Example /// -/// use std::rt::io; -/// use std::rt::io::fs; +/// use std::io; +/// use std::io::fs; /// /// fs::chmod(&Path::new("file.txt"), io::UserFile); /// fs::chmod(&Path::new("file.txt"), io::UserRead | io::UserWrite); @@ -453,7 +454,7 @@ pub fn readlink(path: &Path) -> Option<Path> { /// # Example /// /// use std::libc::S_IRWXU; -/// use std::rt::io::fs; +/// use std::io::fs; /// /// let p = Path::new("/some/dir"); /// fs::mkdir(&p, S_IRWXU as int); @@ -474,7 +475,7 @@ pub fn mkdir(path: &Path, mode: FilePermission) { /// /// # Example /// -/// use std::rt::io::fs; +/// use std::io::fs; /// /// let p = Path::new("/some/dir"); /// fs::rmdir(&p); @@ -495,7 +496,7 @@ pub fn rmdir(path: &Path) { /// /// # Example /// -/// use std::rt::io::fs; +/// use std::io::fs; /// /// // one possible implementation of fs::walk_dir only visiting files /// fn visit_dirs(dir: &Path, cb: &fn(&Path)) { @@ -716,8 +717,8 @@ impl path::Path { #[cfg(test)] mod test { use prelude::*; - use rt::io::{SeekSet, SeekCur, SeekEnd, io_error, Read, Open, ReadWrite}; - use rt::io; + use io::{SeekSet, SeekCur, SeekEnd, io_error, Read, Open, ReadWrite}; + use io; use str; use super::{File, rmdir, mkdir, readdir, rmdir_recursive, mkdir_recursive, copy, unlink, stat, symlink, link, readlink, chmod, diff --git a/src/libstd/rt/io/mem.rs b/src/libstd/io/mem.rs index 6803637d7cb..e754d9be85e 100644 --- a/src/libstd/rt/io/mem.rs +++ b/src/libstd/io/mem.rs @@ -226,7 +226,7 @@ pub fn with_mem_writer(writeFn:&fn(&mut MemWriter)) -> ~[u8] { mod test { use prelude::*; use super::*; - use rt::io::*; + use io::*; #[test] fn test_mem_writer() { diff --git a/src/libstd/rt/io/mod.rs b/src/libstd/io/mod.rs index ce9504a5b43..8858d0a14ad 100644 --- a/src/libstd/rt/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -19,8 +19,6 @@ file, TCP, UDP, Unix domain sockets. Readers and Writers may be composed to add capabilities like string parsing, encoding, and compression. -This will likely live in std::io, not std::rt::io. - # Examples Some examples of obvious things you might want to do @@ -240,16 +238,20 @@ Out of scope */ +#[allow(missing_doc)]; + use cast; +use container::Container; use int; -use path::Path; -use str::{StrSlice, OwnedStr}; +use iter::Iterator; use option::{Option, Some, None}; +use path::Path; use result::{Ok, Err, Result}; -use iter::Iterator; +use str::{StrSlice, OwnedStr}; use to_str::ToStr; use uint; use unstable::finally::Finally; +use vec::{OwnedVector, MutableVector}; use vec; // Reexports diff --git a/src/libstd/rt/io/native/file.rs b/src/libstd/io/native/file.rs index 69d1159bf91..0f1a64edb60 100644 --- a/src/libstd/rt/io/native/file.rs +++ b/src/libstd/io/native/file.rs @@ -229,7 +229,7 @@ mod tests { use libc; use os; use prelude::*; - use rt::io::{io_error, SeekSet}; + use io::{io_error, SeekSet}; use super::*; #[ignore(cfg(target_os = "freebsd"))] // hmm, maybe pipes have a tiny buffer @@ -714,8 +714,8 @@ mod old_os { #[test] fn test_path_is_dir() { - use rt::io::fs::{mkdir_recursive}; - use rt::io::{File, UserRWX}; + use io::fs::{mkdir_recursive}; + use io::{File, UserRWX}; assert!((path_is_dir(&Path::new(".")))); assert!((!path_is_dir(&Path::new("test/stdtest/fs.rs")))); @@ -742,8 +742,8 @@ mod old_os { #[test] fn test_path_exists() { - use rt::io::fs::mkdir_recursive; - use rt::io::UserRWX; + use io::fs::mkdir_recursive; + use io::UserRWX; assert!((path_exists(&Path::new(".")))); assert!((!path_exists(&Path::new( diff --git a/src/libstd/rt/io/native/process.rs b/src/libstd/io/native/process.rs index 9bf0ed63e8c..de03ac1c07d 100644 --- a/src/libstd/rt/io/native/process.rs +++ b/src/libstd/io/native/process.rs @@ -14,7 +14,7 @@ use libc; use os; use prelude::*; use ptr; -use rt::io; +use io; use super::file; /** diff --git a/src/libstd/rt/io/native/stdio.rs b/src/libstd/io/native/stdio.rs index ddfbb9a8f8c..68748ab49a3 100644 --- a/src/libstd/rt/io/native/stdio.rs +++ b/src/libstd/io/native/stdio.rs @@ -10,7 +10,7 @@ use libc; use option::Option; -use rt::io::{Reader, Writer}; +use io::{Reader, Writer}; use super::file; /// Creates a new handle to the stdin of this process diff --git a/src/libstd/rt/io/net/addrinfo.rs b/src/libstd/io/net/addrinfo.rs index 684a6429775..7e2d1fc5e83 100644 --- a/src/libstd/rt/io/net/addrinfo.rs +++ b/src/libstd/io/net/addrinfo.rs @@ -19,9 +19,10 @@ getaddrinfo() use option::{Option, Some, None}; use result::{Ok, Err}; -use rt::io::{io_error}; -use rt::io::net::ip::{SocketAddr, IpAddr}; +use io::{io_error}; +use io::net::ip::{SocketAddr, IpAddr}; use rt::rtio::{IoFactory, with_local_io}; +use vec::ImmutableVector; /// Hints to the types of sockets that are desired when looking up hosts pub enum SocketType { @@ -110,7 +111,7 @@ fn lookup(hostname: Option<&str>, servname: Option<&str>, #[cfg(test)] mod test { use option::Some; - use rt::io::net::ip::Ipv4Addr; + use io::net::ip::Ipv4Addr; use super::*; #[test] diff --git a/src/libstd/rt/io/net/ip.rs b/src/libstd/io/net/ip.rs index f72d2e1f19b..07240a4a509 100644 --- a/src/libstd/rt/io/net/ip.rs +++ b/src/libstd/io/net/ip.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use vec::MutableCloneableVector; -use to_str::ToStr; +use container::Container; use from_str::FromStr; use option::{Option, None, Some}; - +use to_str::ToStr; +use vec::{MutableCloneableVector, ImmutableVector}; pub type Port = u16; diff --git a/src/libstd/rt/io/net/mod.rs b/src/libstd/io/net/mod.rs index cf109167089..cf109167089 100644 --- a/src/libstd/rt/io/net/mod.rs +++ b/src/libstd/io/net/mod.rs diff --git a/src/libstd/rt/io/net/tcp.rs b/src/libstd/io/net/tcp.rs index 493ed6aba87..a59d652d739 100644 --- a/src/libstd/rt/io/net/tcp.rs +++ b/src/libstd/io/net/tcp.rs @@ -10,9 +10,9 @@ use option::{Option, Some, None}; use result::{Ok, Err}; -use rt::io::net::ip::SocketAddr; -use rt::io::{Reader, Writer, Listener, Acceptor}; -use rt::io::{io_error, EndOfFile}; +use io::net::ip::SocketAddr; +use io::{Reader, Writer, Listener, Acceptor}; +use io::{io_error, EndOfFile}; use rt::rtio::{IoFactory, with_local_io, RtioSocket, RtioTcpListener, RtioTcpAcceptor, RtioTcpStream}; @@ -41,7 +41,7 @@ impl TcpStream { match self.obj.peer_name() { Ok(pn) => Some(pn), Err(ioerr) => { - rtdebug!("failed to get peer name: {:?}", ioerr); + debug!("failed to get peer name: {:?}", ioerr); io_error::cond.raise(ioerr); None } @@ -52,7 +52,7 @@ impl TcpStream { match self.obj.socket_name() { Ok(sn) => Some(sn), Err(ioerr) => { - rtdebug!("failed to get socket name: {:?}", ioerr); + debug!("failed to get socket name: {:?}", ioerr); io_error::cond.raise(ioerr); None } @@ -107,7 +107,7 @@ impl TcpListener { match self.obj.socket_name() { Ok(sn) => Some(sn), Err(ioerr) => { - rtdebug!("failed to get socket name: {:?}", ioerr); + debug!("failed to get socket name: {:?}", ioerr); io_error::cond.raise(ioerr); None } @@ -148,8 +148,8 @@ mod test { use super::*; use cell::Cell; use rt::test::*; - use rt::io::net::ip::{Ipv4Addr, SocketAddr}; - use rt::io::*; + use io::net::ip::{Ipv4Addr, SocketAddr}; + use io::*; use prelude::*; use rt::comm::oneshot; @@ -514,7 +514,7 @@ mod test { let mut buf = [0]; stream.read(buf); assert!(buf[0] == i as u8); - rtdebug!("read"); + debug!("read"); } } } @@ -526,11 +526,11 @@ mod test { if i == MAX { return } do spawntask { - rtdebug!("connecting"); + debug!("connecting"); let mut stream = TcpStream::connect(addr); // Connect again before writing connect(i + 1, addr); - rtdebug!("writing"); + debug!("writing"); stream.write([i as u8]); } } @@ -556,7 +556,7 @@ mod test { let mut buf = [0]; stream.read(buf); assert!(buf[0] == i as u8); - rtdebug!("read"); + debug!("read"); } } } @@ -568,11 +568,11 @@ mod test { if i == MAX { return } do spawntask { - rtdebug!("connecting"); + debug!("connecting"); let mut stream = TcpStream::connect(addr); // Connect again before writing connect(i + 1, addr); - rtdebug!("writing"); + debug!("writing"); stream.write([i as u8]); } } @@ -598,7 +598,7 @@ mod test { let mut buf = [0]; stream.read(buf); assert!(buf[0] == 99); - rtdebug!("read"); + debug!("read"); } } } @@ -610,11 +610,11 @@ mod test { if i == MAX { return } do spawntask_later { - rtdebug!("connecting"); + debug!("connecting"); let mut stream = TcpStream::connect(addr); // Connect again before writing connect(i + 1, addr); - rtdebug!("writing"); + debug!("writing"); stream.write([99]); } } @@ -639,7 +639,7 @@ mod test { let mut buf = [0]; stream.read(buf); assert!(buf[0] == 99); - rtdebug!("read"); + debug!("read"); } } } @@ -651,11 +651,11 @@ mod test { if i == MAX { return } do spawntask_later { - rtdebug!("connecting"); + debug!("connecting"); let mut stream = TcpStream::connect(addr); // Connect again before writing connect(i + 1, addr); - rtdebug!("writing"); + debug!("writing"); stream.write([99]); } } diff --git a/src/libstd/rt/io/net/udp.rs b/src/libstd/io/net/udp.rs index f9cf8f5f9ae..1a2245ac442 100644 --- a/src/libstd/rt/io/net/udp.rs +++ b/src/libstd/io/net/udp.rs @@ -10,9 +10,9 @@ use option::{Option, Some, None}; use result::{Ok, Err}; -use rt::io::net::ip::SocketAddr; -use rt::io::{Reader, Writer}; -use rt::io::{io_error, EndOfFile}; +use io::net::ip::SocketAddr; +use io::{Reader, Writer}; +use io::{io_error, EndOfFile}; use rt::rtio::{RtioSocket, RtioUdpSocket, IoFactory, with_local_io}; pub struct UdpSocket { @@ -60,7 +60,7 @@ impl UdpSocket { match self.obj.socket_name() { Ok(sn) => Some(sn), Err(ioerr) => { - rtdebug!("failed to get socket name: {:?}", ioerr); + debug!("failed to get socket name: {:?}", ioerr); io_error::cond.raise(ioerr); None } @@ -106,8 +106,8 @@ impl Writer for UdpStream { mod test { use super::*; use rt::test::*; - use rt::io::net::ip::{Ipv4Addr, SocketAddr}; - use rt::io::*; + use io::net::ip::{Ipv4Addr, SocketAddr}; + use io::*; use option::{Some, None}; use rt::comm::oneshot; use cell::Cell; diff --git a/src/libstd/rt/io/net/unix.rs b/src/libstd/io/net/unix.rs index dd8a999c6de..c6b4a2f2a42 100644 --- a/src/libstd/rt/io/net/unix.rs +++ b/src/libstd/io/net/unix.rs @@ -27,8 +27,8 @@ use prelude::*; use c_str::ToCStr; use rt::rtio::{IoFactory, RtioUnixListener, with_local_io}; use rt::rtio::{RtioUnixAcceptor, RtioPipe}; -use rt::io::pipe::PipeStream; -use rt::io::{io_error, Listener, Acceptor, Reader, Writer}; +use io::pipe::PipeStream; +use io::{io_error, Listener, Acceptor, Reader, Writer}; /// A stream which communicates over a named pipe. pub struct UnixStream { @@ -52,7 +52,7 @@ impl UnixStream { /// /// # Example /// - /// use std::rt::io::net::unix::UnixStream; + /// use std::io::net::unix::UnixStream; /// /// let server = Path("path/to/my/socket"); /// let mut stream = UnixStream::connect(&server); @@ -98,7 +98,7 @@ impl UnixListener { /// /// # Example /// - /// use std::rt::io::net::unix::UnixListener; + /// use std::io::net::unix::UnixListener; /// /// let server = Path("path/to/my/socket"); /// let mut stream = UnixListener::bind(&server); @@ -154,7 +154,7 @@ mod tests { use super::*; use cell::Cell; use rt::test::*; - use rt::io::*; + use io::*; use rt::comm::oneshot; fn smalltest(server: ~fn(UnixStream), client: ~fn(UnixStream)) { diff --git a/src/libstd/rt/io/option.rs b/src/libstd/io/option.rs index 5938252571f..5938252571f 100644 --- a/src/libstd/rt/io/option.rs +++ b/src/libstd/io/option.rs diff --git a/src/libstd/rt/io/pipe.rs b/src/libstd/io/pipe.rs index fbbd5a83561..edbc6fa4285 100644 --- a/src/libstd/rt/io/pipe.rs +++ b/src/libstd/io/pipe.rs @@ -15,8 +15,8 @@ use prelude::*; use super::{Reader, Writer}; -use rt::io::{io_error, EndOfFile}; -use rt::io::native::file; +use io::{io_error, EndOfFile}; +use io::native::file; use rt::rtio::{RtioPipe, with_local_io}; pub struct PipeStream { @@ -34,7 +34,7 @@ impl PipeStream { /// # Example /// /// use std::libc; - /// use std::rt::io::pipe; + /// use std::io::pipe; /// /// let mut pipe = PipeStream::open(libc::STDERR_FILENO); /// pipe.write(bytes!("Hello, stderr!")); diff --git a/src/libstd/rt/io/process.rs b/src/libstd/io/process.rs index 6b21cde2488..3941003d1c0 100644 --- a/src/libstd/rt/io/process.rs +++ b/src/libstd/io/process.rs @@ -14,8 +14,8 @@ use prelude::*; use cell::Cell; use libc; -use rt::io; -use rt::io::io_error; +use io; +use io::io_error; use rt::rtio::{RtioProcess, IoFactory, with_local_io}; use fmt; diff --git a/src/libstd/rt/io/signal.rs b/src/libstd/io/signal.rs index 3f013d5cac9..1310152d05f 100644 --- a/src/libstd/rt/io/signal.rs +++ b/src/libstd/io/signal.rs @@ -19,12 +19,13 @@ definitions for a number of signals. */ -use container::{Map, MutableMap}; +use clone::Clone; use comm::{Port, SharedChan, stream}; +use container::{Map, MutableMap}; use hashmap; +use io::io_error; use option::{Some, None}; use result::{Err, Ok}; -use rt::io::io_error; use rt::rtio::{IoFactory, RtioSignal, with_local_io}; #[repr(int)] @@ -61,7 +62,7 @@ pub enum Signum { /// # Example /// /// ```rust -/// use std::rt::io::signal::{Listener, Interrupt}; +/// use std::io::signal::{Listener, Interrupt}; /// /// let mut listener = Listener::new(); /// listener.register(signal::Interrupt); @@ -148,7 +149,7 @@ impl Listener { #[cfg(test)] mod test { use libc; - use rt::io::timer; + use io::timer; use super::{Listener, Interrupt}; use comm::{GenericPort, Peekable}; @@ -207,7 +208,7 @@ mod test { #[cfg(windows)] #[test] fn test_io_signal_invalid_signum() { - use rt::io; + use io; use super::User1; let mut s = Listener::new(); let mut called = false; diff --git a/src/libstd/rt/io/stdio.rs b/src/libstd/io/stdio.rs index e829c77cec1..302d7579873 100644 --- a/src/libstd/rt/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -18,7 +18,7 @@ about the stream or terminal that it is attached to. # Example ```rust -use std::rt::io; +use std::io; let mut out = io::stdout(); out.write(bytes!("Hello, world!")); @@ -30,7 +30,7 @@ use fmt; use libc; use option::{Option, Some, None}; use result::{Ok, Err}; -use rt::io::buffered::LineBufferedWriter; +use io::buffered::LineBufferedWriter; use rt::rtio::{IoFactory, RtioTTY, RtioFileStream, with_local_io, CloseAsynchronously}; use super::{Reader, Writer, io_error, IoError, OtherIoError, diff --git a/src/libstd/rt/io/timer.rs b/src/libstd/io/timer.rs index 48e0182354a..219f63026d2 100644 --- a/src/libstd/rt/io/timer.rs +++ b/src/libstd/io/timer.rs @@ -19,7 +19,7 @@ and create ports which will receive notifications after a period of time. ```rust -use std::rt::io::Timer; +use std::io::Timer; let mut timer = Timer::new().unwrap(); timer.sleep(10); // block the task for awhile @@ -41,7 +41,7 @@ loop { use comm::{Port, PortOne}; use option::{Option, Some, None}; use result::{Ok, Err}; -use rt::io::io_error; +use io::io_error; use rt::rtio::{IoFactory, RtioTimer, with_local_io}; pub struct Timer { @@ -64,7 +64,7 @@ impl Timer { match io.timer_init() { Ok(t) => Some(Timer { obj: t }), Err(ioerr) => { - rtdebug!("Timer::init: failed to init: {:?}", ioerr); + debug!("Timer::init: failed to init: {:?}", ioerr); io_error::cond.raise(ioerr); None } diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 967aee9135d..e0908dcb290 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -21,7 +21,7 @@ //! boxes (`owned`), and unsafe and borrowed pointers (`ptr`, `borrowed`). //! Additionally, `std` provides pervasive types (`option` and `result`), //! task creation and communication primitives (`task`, `comm`), platform -//! abstractions (`os` and `path`), basic I/O abstractions (`rt::io`), common +//! abstractions (`os` and `path`), basic I/O abstractions (`io`), common //! traits (`kinds`, `ops`, `cmp`, `num`, `to_str`), and complete bindings //! to the C standard library (`libc`). //! @@ -68,7 +68,7 @@ #[allow(cstack)]; // NOTE: remove after the next snapshot. // When testing libstd, bring in libuv as the I/O backend so tests can print -// things and all of the std::rt::io tests have an I/O interface to run on top +// things and all of the std::io tests have an I/O interface to run on top // of #[cfg(test)] extern mod rustuv(vers = "0.9-pre"); @@ -179,6 +179,7 @@ pub mod local_data; pub mod libc; pub mod c_str; pub mod os; +pub mod io; pub mod path; pub mod rand; pub mod run; @@ -225,6 +226,7 @@ mod std { pub use logging; pub use option; pub use os; + pub use io; pub use rt; pub use str; pub use to_bytes; diff --git a/src/libstd/os.rs b/src/libstd/os.rs index ff24c35d4e6..213cf5dc07c 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -388,7 +388,7 @@ pub fn self_exe_path() -> Option<Path> { #[cfg(target_os = "linux")] #[cfg(target_os = "android")] fn load_self() -> Option<~[u8]> { - use std::rt::io; + use std::io; match io::result(|| io::fs::readlink(&Path::new("/proc/self/exe"))) { Ok(Some(path)) => Some(path.as_vec().to_owned()), @@ -1447,8 +1447,8 @@ mod tests { use result::{Ok, Err}; use os::*; use libc::*; - use rt::io; - use rt::io::fs; + use io; + use io::fs; #[cfg(unix)] fn lseek_(fd: c_int, size: uint) { diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index 0190b02fbc0..d3797cf8099 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -40,7 +40,7 @@ pub use result::{Result, Ok, Err}; // Reexported functions pub use from_str::from_str; pub use iter::range; -pub use rt::io::stdio::{print, println}; +pub use io::stdio::{print, println}; // Reexported types and traits @@ -67,7 +67,7 @@ pub use num::{Orderable, Signed, Unsigned, Round}; pub use num::{Primitive, Int, Float, ToStrRadix, ToPrimitive, FromPrimitive}; pub use path::{GenericPath, Path, PosixPath, WindowsPath}; pub use ptr::RawPtr; -pub use rt::io::{Writer, Reader, Seek}; +pub use io::{Writer, Reader, Seek}; pub use send_str::{SendStr, SendStrOwned, SendStrStatic, IntoSendStr}; pub use str::{Str, StrVector, StrSlice, OwnedStr}; pub use to_bytes::IterBytes; diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs index 73d5c72a728..60fc1e0c6bc 100644 --- a/src/libstd/rand/os.rs +++ b/src/libstd/rand/os.rs @@ -17,7 +17,7 @@ use ops::Drop; #[cfg(unix)] use rand::reader::ReaderRng; #[cfg(unix)] -use rt::io::File; +use io::File; #[cfg(windows)] use cast; diff --git a/src/libstd/rand/reader.rs b/src/libstd/rand/reader.rs index b98dade4bf6..4beabb8bf6a 100644 --- a/src/libstd/rand/reader.rs +++ b/src/libstd/rand/reader.rs @@ -11,7 +11,7 @@ //! A wrapper around any Reader to treat it as an RNG. use option::{Some, None}; -use rt::io::Reader; +use io::Reader; use rand::Rng; @@ -24,7 +24,7 @@ use rand::Rng; /// /// ```rust /// use std::rand::{reader, Rng}; -/// use std::rt::io::mem; +/// use std::io::mem; /// /// fn main() { /// let mut rng = reader::ReaderRng::new(mem::MemReader::new(~[1,2,3,4,5,6,7,8])); @@ -77,7 +77,7 @@ impl<R: Reader> Rng for ReaderRng<R> { #[cfg(test)] mod test { use super::*; - use rt::io::mem::MemReader; + use io::mem::MemReader; use cast; #[test] diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs index e939be64d73..3f8da64b3d6 100644 --- a/src/libstd/repr.rs +++ b/src/libstd/repr.rs @@ -19,7 +19,7 @@ More runtime type reflection use cast::transmute; use char; use container::Container; -use rt::io; +use io; use iter::Iterator; use libc::c_void; use option::{Some, None}; @@ -621,8 +621,8 @@ pub fn write_repr<T>(writer: &mut io::Writer, object: &T) { pub fn repr_to_str<T>(t: &T) -> ~str { use str; - use rt::io; - use rt::io::Decorator; + use io; + use io::Decorator; let mut result = io::mem::MemWriter::new(); write_repr(&mut result as &mut io::Writer, t); @@ -637,7 +637,7 @@ fn test_repr() { use prelude::*; use str; use str::Str; - use rt::io::Decorator; + use io::Decorator; use util::swap; use char::is_alphabetic; diff --git a/src/libstd/rt/logging.rs b/src/libstd/rt/logging.rs index f346380ff7a..55a6280a1f4 100644 --- a/src/libstd/rt/logging.rs +++ b/src/libstd/rt/logging.rs @@ -12,9 +12,9 @@ use fmt; use from_str::from_str; use libc::exit; use option::{Some, None, Option}; -use rt::io; -use rt::io::stdio::StdWriter; -use rt::io::buffered::LineBufferedWriter; +use io; +use io::stdio::StdWriter; +use io::buffered::LineBufferedWriter; use rt::crate_map::{ModEntry, CrateMap, iter_crate_map, get_crate_map}; use str::StrSlice; use u32; diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index f18b4dc4234..c90aafff20c 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -116,8 +116,10 @@ mod kill; /// The coroutine task scheduler, built on the `io` event loop. pub mod sched; -/// Synchronous I/O. -pub mod io; +#[cfg(stage0)] +pub mod io { + pub use io::stdio; +} /// The EventLoop and internal synchronous I/O interface. pub mod rtio; diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs index 9b1103b8a74..ca1fd413a56 100644 --- a/src/libstd/rt/rtio.rs +++ b/src/libstd/rt/rtio.rs @@ -8,21 +8,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use c_str::CString; +use comm::{SharedChan, PortOne, Port}; +use libc::c_int; use libc; use option::*; +use path::Path; use result::*; -use comm::{SharedChan, PortOne, Port}; -use libc::c_int; -use c_str::CString; -use ai = rt::io::net::addrinfo; -use rt::io::IoError; -use rt::io::signal::Signum; -use super::io::process::{ProcessConfig, ProcessExit}; -use super::io::net::ip::{IpAddr, SocketAddr}; -use path::Path; -use super::io::{SeekStyle}; -use super::io::{FileMode, FileAccess, FileStat, FilePermission}; +use ai = io::net::addrinfo; +use io::IoError; +use io::net::ip::{IpAddr, SocketAddr}; +use io::process::{ProcessConfig, ProcessExit}; +use io::signal::Signum; +use io::{FileMode, FileAccess, FileStat, FilePermission}; +use io::{SeekStyle}; pub trait Callback { fn call(&mut self); @@ -78,7 +78,7 @@ pub enum CloseBehavior { pub fn with_local_io<T>(f: &fn(&mut IoFactory) -> Option<T>) -> Option<T> { use rt::sched::Scheduler; use rt::local::Local; - use rt::io::{io_error, standard_error, IoUnavailable}; + use io::{io_error, standard_error, IoUnavailable}; unsafe { let sched: *mut Scheduler = Local::unsafe_borrow(); diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs index f4e5811acd3..26cd405efe2 100644 --- a/src/libstd/rt/sched.rs +++ b/src/libstd/rt/sched.rs @@ -1133,7 +1133,7 @@ mod test { #[test] fn test_io_callback() { - use rt::io::timer; + use io::timer; // This is a regression test that when there are no schedulable tasks // in the work queue, but we are performing I/O, that once we do put diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs index 7620a4371c1..e73d15abb6c 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -29,7 +29,7 @@ use rt::borrowck; use rt::context::Context; use rt::context; use rt::env; -use rt::io::Writer; +use io::Writer; use rt::kill::Death; use rt::local::Local; use rt::logging::StdErrLogger; diff --git a/src/libstd/rt/test.rs b/src/libstd/rt/test.rs index 3db9c049eb2..19ab36a6ac4 100644 --- a/src/libstd/rt/test.rs +++ b/src/libstd/rt/test.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use super::io::net::ip::{SocketAddr, Ipv4Addr, Ipv6Addr}; +use io::net::ip::{SocketAddr, Ipv4Addr, Ipv6Addr}; use cell::Cell; use clone::Clone; diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index 50f73becef2..42546cb3c6a 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -68,8 +68,8 @@ pub fn default_sched_threads() -> uint { } pub fn dumb_println(args: &fmt::Arguments) { - use rt::io::native::stdio::stderr; - use rt::io::{Writer, io_error, ResourceUnavailable}; + use io::native::stdio::stderr; + use io::{Writer, io_error, ResourceUnavailable}; use rt::task::Task; use rt::local::Local; diff --git a/src/libstd/run.rs b/src/libstd/run.rs index c9b33a14c52..3bc56d2653a 100644 --- a/src/libstd/run.rs +++ b/src/libstd/run.rs @@ -14,13 +14,13 @@ use cell::Cell; use comm::{stream, SharedChan}; +use io::Reader; +use io::process::ProcessExit; +use io::process; +use io; use libc::{pid_t, c_int}; use libc; use prelude::*; -use rt::io::process; -use rt::io::process::ProcessExit; -use rt::io; -use rt::io::Reader; use task; /** @@ -335,8 +335,8 @@ mod tests { use str; use task::spawn; use unstable::running_on_valgrind; - use rt::io::native::file; - use rt::io::{Writer, Reader}; + use io::native::file; + use io::{Writer, Reader}; #[test] #[cfg(not(target_os="android"))] // FIXME(#10380) diff --git a/src/libstd/to_bytes.rs b/src/libstd/to_bytes.rs index 8c78e34528b..8b424c53be0 100644 --- a/src/libstd/to_bytes.rs +++ b/src/libstd/to_bytes.rs @@ -358,8 +358,8 @@ pub trait ToBytes { impl<A:IterBytes> ToBytes for A { fn to_bytes(&self, lsb0: bool) -> ~[u8] { - use rt::io::mem; - use rt::io::Writer; + use io::mem; + use io::Writer; do mem::with_mem_writer |wr| { do self.iter_bytes(lsb0) |bytes| { |
