use core::kinds::Sized;
use fmt;
use iter::IteratorExt;
-use kinds::Copy;
use mem;
use ops::FnMut;
use option::Option;
use vec::Vec;
/// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero.
-#[deriving(Clone, PartialEq, PartialOrd, Ord, Eq, Hash)]
+#[deriving(Clone, Copy, PartialEq, PartialOrd, Ord, Eq, Hash)]
pub struct Ascii { chr: u8 }
-impl Copy for Ascii {}
-
impl Ascii {
/// Converts an ascii character into a `u8`.
#[inline]
/// This enumeration is the list of the possible reasons that try_recv could not
/// return data when called.
-#[deriving(PartialEq, Clone, Show)]
+#[deriving(PartialEq, Clone, Copy, Show)]
#[experimental = "this is likely to be removed in changing try_recv()"]
pub enum TryRecvError {
/// This channel is currently empty, but the sender(s) have not yet
Disconnected,
}
-impl Copy for TryRecvError {}
-
/// This enumeration is the list of the possible error outcomes for the
/// `SyncSender::try_send` method.
#[deriving(PartialEq, Clone, Show)]
use c_str::{CString, ToCStr};
use libc;
- use kinds::Copy;
use ops::FnOnce;
use ptr;
use result::*;
dlclose(handle as *mut libc::c_void); ()
}
+ #[deriving(Copy)]
pub enum Rtld {
Lazy = 1,
Now = 2,
Local = 0,
}
- impl Copy for Rtld {}
-
#[link_name = "dl"]
extern {
fn dlopen(filename: *const libc::c_char,
use fmt;
use int;
use iter::{Iterator, IteratorExt};
-use kinds::Copy;
use mem::transmute;
use ops::{BitOr, BitXor, BitAnd, Sub, Not, FnOnce};
use option::Option;
}
/// A list specifying general categories of I/O error.
-#[deriving(PartialEq, Eq, Clone, Show)]
+#[deriving(Copy, PartialEq, Eq, Clone, Show)]
pub enum IoErrorKind {
/// Any I/O error not part of this list.
OtherIoError,
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
/// When seeking, the resulting cursor is offset from a base by the offset given
/// to the `seek` function. The base used is specified by this enumeration.
+#[deriving(Copy)]
pub enum SeekStyle {
/// Seek from the beginning of the stream
SeekSet,
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.
/// A mode specifies how a file should be opened or created. These modes are
/// passed to `File::open_mode` and are used to control where the file is
/// positioned when it is initially opened.
+#[deriving(Copy)]
pub enum FileMode {
/// Opens a file positioned at the beginning.
Open,
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.
+#[deriving(Copy)]
pub enum FileAccess {
/// Read-only access, requests to write will result in an error
Read,
ReadWrite,
}
-impl Copy for FileAccess {}
-
/// Different kinds of files which can be identified by a call to stat
-#[deriving(PartialEq, Show, Hash, Clone)]
+#[deriving(Copy, PartialEq, Show, Hash, Clone)]
pub enum FileType {
/// This is a normal file, corresponding to `S_IFREG`
RegularFile,
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`.
///
/// println!("byte size: {}", info.size);
/// # }
/// ```
-#[deriving(Hash)]
+#[deriving(Copy, Hash)]
pub struct FileStat {
/// The size of the file, in bytes
pub size: u64,
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
/// have different meanings or no meaning at all on some platforms.
#[unstable]
-#[deriving(Hash)]
+#[deriving(Copy, Hash)]
pub struct UnstableFileStat {
/// The ID of the device containing the file.
pub device: u64,
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."]
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;
use vec::Vec;
/// Hints to the types of sockets that are desired when looking up hosts
+#[deriving(Copy)]
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.
///
/// The meaning of each of these flags can be found with `man -s 3 getaddrinfo`
+#[deriving(Copy)]
pub enum Flag {
AddrConfig,
All,
V4Mapped,
}
-impl Copy for Flag {}
-
/// A transport protocol associated with either a hint or a return value of
/// `lookup`
+#[deriving(Copy)]
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.
///
/// For details on these fields, see their corresponding definitions via
/// `man -s 3 getaddrinfo`
+#[deriving(Copy)]
pub struct Hint {
pub family: uint,
pub socktype: Option<SocketType>,
pub flags: uint,
}
-impl Copy for Hint {}
-
+#[deriving(Copy)]
pub struct Info {
pub address: SocketAddr,
pub family: uint,
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>> {
pub use self::IpAddr::*;
use fmt;
-use kinds::Copy;
use io::{mod, IoResult, IoError};
use io::net;
use iter::{Iterator, IteratorExt};
pub type Port = u16;
-#[deriving(PartialEq, Eq, Clone, Hash)]
+#[deriving(Copy, PartialEq, Eq, Clone, Hash)]
pub enum IpAddr {
Ipv4Addr(u8, u8, u8, u8),
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 {
}
}
-#[deriving(PartialEq, Eq, Clone, Hash)]
+#[deriving(Copy, PartialEq, Eq, Clone, Hash)]
pub struct SocketAddr {
pub ip: IpAddr,
pub port: Port,
}
-impl Copy for SocketAddr {}
-
impl fmt::Show for SocketAddr {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self.ip {
}
/// Describes what to do with a standard io stream for a child process.
-#[deriving(Clone)]
+#[deriving(Clone, Copy)]
pub enum StdioContainer {
/// This stream will be ignored. This is the equivalent of attaching the
/// stream to `/dev/null`
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)]
+#[deriving(PartialEq, Eq, Clone, Copy)]
pub enum ProcessExit {
/// Normal termination with an exit status.
ExitStatus(int),
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 {
}
/// A `Writer` which ignores bytes written to it, like /dev/null.
+#[deriving(Copy)]
pub struct NullWriter;
-impl Copy for NullWriter {}
-
impl Writer for NullWriter {
#[inline]
fn write(&mut self, _buf: &[u8]) -> io::IoResult<()> { Ok(()) }
}
/// A `Reader` which returns an infinite stream of 0 bytes, like /dev/zero.
+#[deriving(Copy)]
pub struct ZeroReader;
-impl Copy for ZeroReader {}
-
impl Reader for ZeroReader {
#[inline]
fn read(&mut self, buf: &mut [u8]) -> io::IoResult<uint> {
}
/// A `Reader` which is always at EOF, like /dev/null.
+#[deriving(Copy)]
pub struct NullReader;
-impl Copy for NullReader {}
-
impl Reader for NullReader {
#[inline]
fn read(&mut self, _buf: &mut [u8]) -> io::IoResult<uint> {
pub use self::SignFormat::*;
use char::{mod, Char};
-use kinds::Copy;
use num::{mod, Int, Float, FPNaN, FPInfinite, ToPrimitive};
use ops::FnMut;
use slice::{SliceExt, CloneSliceExt};
use vec::Vec;
/// A flag that specifies whether to use exponential (scientific) notation.
+#[deriving(Copy)]
pub enum ExponentFormat {
/// Do not use exponential notation.
ExpNone,
ExpBin,
}
-impl Copy for ExponentFormat {}
-
/// The number of digits used for emitting the fractional part of a number, if
/// any.
+#[deriving(Copy)]
pub enum SignificantDigits {
/// All calculable digits will be printed.
///
DigExact(uint)
}
-impl Copy for SignificantDigits {}
-
/// How to emit the sign of a number.
+#[deriving(Copy)]
pub enum SignFormat {
/// No sign will be printed. The exponent sign will also be emitted.
SignNone,
SignAll,
}
-impl Copy for SignFormat {}
-
/// Converts an integral number to its string representation as a byte vector.
/// This is meant to be a common base implementation for all integral string
/// conversion functions like `to_string()` or `to_str_radix()`.
}
/// A low-level OS in-memory pipe.
+#[deriving(Copy)]
pub struct Pipe {
/// A file descriptor representing the reading end of the pipe. Data written
/// on the `out` file descriptor can be read from this file descriptor.
pub writer: c_int,
}
-impl Copy for Pipe {}
-
/// Creates a new low-level OS in-memory pipe.
///
/// This function can fail to succeed if there are no more resources available
impl Copy for MapOption {}
/// Possible errors when creating a map.
+#[deriving(Copy)]
pub enum MapError {
/// # The following are POSIX-specific
///
ErrMapViewOfFile(uint)
}
-impl Copy for MapError {}
-
impl fmt::Show for MapError {
fn fmt(&self, out: &mut fmt::Formatter) -> fmt::Result {
let str = match *self {
use io::Writer;
use iter::{AdditiveIterator, DoubleEndedIteratorExt, Extend};
use iter::{Iterator, IteratorExt, Map};
-use kinds::Copy;
use mem;
use option::Option;
use option::Option::{Some, None};
}
/// Prefix types for Path
-#[deriving(PartialEq, Clone, Show)]
+#[deriving(Copy, PartialEq, Clone, Show)]
pub enum PathPrefix {
/// Prefix `\\?\`, uint is the length of the following component
VerbatimPrefix(uint),
DiskPrefix
}
-impl Copy for PathPrefix {}
-
fn parse_prefix<'a>(mut path: &'a str) -> Option<PathPrefix> {
if path.starts_with("\\\\") {
// \\
use clone::Clone;
use io::IoResult;
use iter::{Iterator, IteratorExt};
-use kinds::Copy;
use mem;
use rc::Rc;
use result::Result::{Ok, Err};
/// The standard RNG. This is designed to be efficient on the current
/// platform.
+#[deriving(Copy)]
pub struct StdRng {
rng: IsaacWordRng,
}
-impl Copy for StdRng {}
-
impl StdRng {
/// Create a randomly seeded instance of `StdRng`.
///
#![experimental]
use {fmt, i64};
-use kinds::Copy;
use ops::{Add, Sub, Mul, Div, Neg, FnOnce};
use option::Option;
use option::Option::{Some, None};
/// ISO 8601 time duration with nanosecond precision.
/// This also allows for the negative duration; see individual methods for details.
-#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord)]
+#[deriving(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Duration {
secs: i64,
nanos: i32, // Always 0 <= nanos < NANOS_PER_SEC
nanos: (i64::MAX % MILLIS_PER_SEC) as i32 * NANOS_PER_MILLI
};
-impl Copy for Duration {}
-
impl Duration {
/// Makes a new `Duration` with given number of weeks.
/// Equivalent to `Duration::seconds(weeks * 7 * 24 * 60 * 60), with overflow checks.