diff --git a/src/libextra/time.rs b/src/libextra/time.rs index f79e01b6f28..1e7b52daab3 100644 --- a/src/libextra/time.rs +++ b/src/libextra/time.rs @@ -34,7 +34,7 @@ pub mod rustrt { } /// A record specifying a time value in seconds and nanoseconds. -#[deriving(Eq, Encodable, Decodable)] +#[deriving(Clone, DeepClone, Eq, Encodable, Decodable)] pub struct Timespec { sec: i64, nsec: i32 } /* @@ -100,7 +100,7 @@ pub fn tzset() { } } -#[deriving(Eq, Encodable, Decodable)] +#[deriving(Clone, DeepClone, Eq, Encodable, Decodable)] pub struct Tm { tm_sec: i32, // seconds after the minute ~[0-60] tm_min: i32, // minutes after the hour ~[0-59] diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 98bf963be9a..e4d63da3ee9 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -20,7 +20,7 @@ use at_vec; use cast; use char; use char::Char; -use clone::Clone; +use clone::{Clone, DeepClone}; use container::{Container, Mutable}; use iter::Times; use iterator::{Iterator, FromIterator, Extendable}; @@ -2104,6 +2104,13 @@ impl Clone for ~str { } } +impl DeepClone for ~str { + #[inline] + fn deep_clone(&self) -> ~str { + self.to_owned() + } +} + impl Clone for @str { #[inline] fn clone(&self) -> @str { @@ -2111,6 +2118,13 @@ impl Clone for @str { } } +impl DeepClone for @str { + #[inline] + fn deep_clone(&self) -> @str { + *self + } +} + impl FromIterator for ~str { #[inline] fn from_iterator>(iterator: &mut T) -> ~str {