diff options
| author | bors <bors@rust-lang.org> | 2013-08-18 07:21:58 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-08-18 07:21:58 -0700 |
| commit | 0a238288d343fc6323b37aad8678b3ea701fb7e3 (patch) | |
| tree | 24572525dc26f39ed021633da2756f748c00cafd /src/libstd | |
| parent | 3bc685842802edfcd2918f911268f8e345cf3c26 (diff) | |
| parent | 1f41140c22dc36f3ab14fbcb04cc67a4c1224bb5 (diff) | |
| download | rust-0a238288d343fc6323b37aad8678b3ea701fb7e3.tar.gz rust-0a238288d343fc6323b37aad8678b3ea701fb7e3.zip | |
auto merge of #8555 : chris-morgan/rust/time-clone, r=huonw
I need `Clone` for `Tm` for my latest work on [rust-http](https://github.com/chris-morgan/rust-http) (static typing for headers, and headers like `Date` are a time), so here it is. @huonw recommended deriving DeepClone while I was at it. I also had to implement `DeepClone` for `~str` to get a derived implementation of `DeepClone` for `Tm`; I did `@str` while I was at it, for consistency.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/str.rs | 16 |
1 files changed, 15 insertions, 1 deletions
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<char> for ~str { #[inline] fn from_iterator<T: Iterator<char>>(iterator: &mut T) -> ~str { |
