diff options
Diffstat (limited to 'src/libstd/io')
| -rw-r--r-- | src/libstd/io/mod.rs | 17 | ||||
| -rw-r--r-- | src/libstd/io/net/addrinfo.rs | 11 | ||||
| -rw-r--r-- | src/libstd/io/net/ip.rs | 5 | ||||
| -rw-r--r-- | src/libstd/io/process.rs | 4 | ||||
| -rw-r--r-- | src/libstd/io/util.rs | 6 |
5 files changed, 43 insertions, 0 deletions
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index d43a7a66c5b..dc212e7cab3 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -231,6 +231,7 @@ use error::{FromError, Error}; use fmt; use int; use iter::{Iterator, IteratorExt}; +use kinds::Copy; use mem::transmute; use ops::{BitOr, BitXor, BitAnd, Sub, Not}; use option::Option; @@ -420,6 +421,8 @@ pub enum IoErrorKind { NoProgress, } +impl Copy for IoErrorKind {} + /// A trait that lets you add a `detail` to an IoError easily trait UpdateIoError<T> { /// Returns an IoError with updated description and detail @@ -1560,6 +1563,8 @@ pub enum SeekStyle { SeekCur, } +impl Copy for SeekStyle {} + /// An object implementing `Seek` internally has some form of cursor which can /// be moved within a stream of bytes. The stream typically has a fixed size, /// allowing seeking relative to either end. @@ -1682,6 +1687,8 @@ pub enum FileMode { Truncate, } +impl Copy for FileMode {} + /// Access permissions with which the file should be opened. `File`s /// opened with `Read` will return an error if written to. pub enum FileAccess { @@ -1693,6 +1700,8 @@ pub enum FileAccess { ReadWrite, } +impl Copy for FileAccess {} + /// Different kinds of files which can be identified by a call to stat #[deriving(PartialEq, Show, Hash, Clone)] pub enum FileType { @@ -1715,6 +1724,8 @@ pub enum FileType { Unknown, } +impl Copy for FileType {} + /// A structure used to describe metadata information about a file. This /// structure is created through the `stat` method on a `Path`. /// @@ -1766,6 +1777,8 @@ pub struct FileStat { pub unstable: UnstableFileStat, } +impl Copy for FileStat {} + /// This structure represents all of the possible information which can be /// returned from a `stat` syscall which is not contained in the `FileStat` /// structure. This information is not necessarily platform independent, and may @@ -1795,6 +1808,8 @@ pub struct UnstableFileStat { pub gen: u64, } +impl Copy for UnstableFileStat {} + bitflags! { #[doc = "A set of permissions for a file or directory is represented"] #[doc = "by a set of flags which are or'd together."] @@ -1889,6 +1904,8 @@ bitflags! { } } +impl Copy for FilePermission {} + impl Default for FilePermission { #[inline] fn default() -> FilePermission { FilePermission::empty() } diff --git a/src/libstd/io/net/addrinfo.rs b/src/libstd/io/net/addrinfo.rs index fea8372733c..fc81ab7b57a 100644 --- a/src/libstd/io/net/addrinfo.rs +++ b/src/libstd/io/net/addrinfo.rs @@ -22,6 +22,7 @@ pub use self::Protocol::*; use iter::IteratorExt; use io::{IoResult}; use io::net::ip::{SocketAddr, IpAddr}; +use kinds::Copy; use option::Option; use option::Option::{Some, None}; use sys; @@ -32,6 +33,8 @@ pub enum SocketType { Stream, Datagram, Raw } +impl Copy for SocketType {} + /// Flags which can be or'd into the `flags` field of a `Hint`. These are used /// to manipulate how a query is performed. /// @@ -46,12 +49,16 @@ pub enum Flag { V4Mapped, } +impl Copy for Flag {} + /// A transport protocol associated with either a hint or a return value of /// `lookup` pub enum Protocol { TCP, UDP } +impl Copy for Protocol {} + /// This structure is used to provide hints when fetching addresses for a /// remote host to control how the lookup is performed. /// @@ -64,6 +71,8 @@ pub struct Hint { pub flags: uint, } +impl Copy for Hint {} + pub struct Info { pub address: SocketAddr, pub family: uint, @@ -72,6 +81,8 @@ pub struct Info { pub flags: uint, } +impl Copy for Info {} + /// Easy name resolution. Given a hostname, returns the list of IP addresses for /// that hostname. pub fn get_host_addresses(host: &str) -> IoResult<Vec<IpAddr>> { diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs index 3fa6f4a6091..f59dd37c0da 100644 --- a/src/libstd/io/net/ip.rs +++ b/src/libstd/io/net/ip.rs @@ -18,6 +18,7 @@ pub use self::IpAddr::*; use fmt; +use kinds::Copy; use io::{mod, IoResult, IoError}; use io::net; use iter::{Iterator, IteratorExt}; @@ -36,6 +37,8 @@ pub enum IpAddr { Ipv6Addr(u16, u16, u16, u16, u16, u16, u16, u16) } +impl Copy for IpAddr {} + impl fmt::Show for IpAddr { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { match *self { @@ -67,6 +70,8 @@ pub struct SocketAddr { pub port: Port, } +impl Copy for SocketAddr {} + impl fmt::Show for SocketAddr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.ip { diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index 61ebfb06c71..c46a6e82e44 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -480,6 +480,8 @@ pub enum StdioContainer { CreatePipe(bool /* readable */, bool /* writable */), } +impl Copy for StdioContainer {} + /// Describes the result of a process after it has terminated. /// Note that Windows have no signals, so the result is usually ExitStatus. #[deriving(PartialEq, Eq, Clone)] @@ -491,6 +493,8 @@ pub enum ProcessExit { ExitSignal(int), } +impl Copy for ProcessExit {} + impl fmt::Show for ProcessExit { /// Format a ProcessExit enum, to nicely present the information. fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index e78bd1dd33f..faa52226a03 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -83,6 +83,8 @@ impl<R: Buffer> Buffer for LimitReader<R> { /// A `Writer` which ignores bytes written to it, like /dev/null. pub struct NullWriter; +impl Copy for NullWriter {} + impl Writer for NullWriter { #[inline] fn write(&mut self, _buf: &[u8]) -> io::IoResult<()> { Ok(()) } @@ -91,6 +93,8 @@ impl Writer for NullWriter { /// A `Reader` which returns an infinite stream of 0 bytes, like /dev/zero. pub struct ZeroReader; +impl Copy for ZeroReader {} + impl Reader for ZeroReader { #[inline] fn read(&mut self, buf: &mut [u8]) -> io::IoResult<uint> { @@ -111,6 +115,8 @@ impl Buffer for ZeroReader { /// A `Reader` which is always at EOF, like /dev/null. pub struct NullReader; +impl Copy for NullReader {} + impl Reader for NullReader { #[inline] fn read(&mut self, _buf: &mut [u8]) -> io::IoResult<uint> { |
