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.
This commit is contained in:
bors
2013-08-18 07:21:58 -07:00
2 changed files with 17 additions and 3 deletions

View File

@@ -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 {