Implement DeepClone for str types.

This commit is contained in:
Chris Morgan 2013-08-16 20:17:02 +10:00
parent 92af0db0a3
commit 14885dade4

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 {