diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-12-14 23:34:36 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-12-19 10:51:01 -0500 |
| commit | 4c6e76b7c8823b3fe259e7f8da21de2c86def554 (patch) | |
| tree | f47d95463c686b2bee314eaa1a9bd8778bfe6c2c /src/libtime/lib.rs | |
| parent | ce9243776932b69359226491187d5d9fc7c2d7b2 (diff) | |
libtime: use `#[deriving(Copy)]`
Diffstat (limited to 'src/libtime/lib.rs')
| -rw-r--r-- | src/libtime/lib.rs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/libtime/lib.rs b/src/libtime/lib.rs index 4129086e9ec..1b7f5cdc4af 100644 --- a/src/libtime/lib.rs +++ b/src/libtime/lib.rs @@ -76,14 +76,12 @@ mod imp { } /// A record specifying a time value in seconds and nanoseconds. -#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord, Encodable, Decodable, Show)] +#[deriving(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Encodable, Decodable, Show)] pub struct Timespec { pub sec: i64, pub nsec: i32, } -impl Copy for Timespec {} - /* * Timespec assumes that pre-epoch Timespecs have negative sec and positive * nsec fields. Darwin's and Linux's struct timespec functions handle pre- @@ -268,7 +266,7 @@ pub fn tzset() { /// also called a broken-down time value. // FIXME: use c_int instead of i32? #[repr(C)] -#[deriving(Clone, PartialEq, Eq, Show)] +#[deriving(Clone, Copy, PartialEq, Eq, Show)] pub struct Tm { /// Seconds after the minute - [0, 60] pub tm_sec: i32, @@ -309,8 +307,6 @@ pub struct Tm { pub tm_nsec: i32, } -impl Copy for Tm {} - pub fn empty_tm() -> Tm { Tm { tm_sec: 0_i32, @@ -452,7 +448,7 @@ impl Tm { } } -#[deriving(PartialEq)] +#[deriving(Copy, PartialEq)] pub enum ParseError { InvalidSecond, InvalidMinute, @@ -470,8 +466,6 @@ pub enum ParseError { UnexpectedCharacter(char, char), } -impl Copy for ParseError {} - impl Show for ParseError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { |
