Implement DeepClone for str types.
This commit is contained in:
parent
92af0db0a3
commit
14885dade4
1 changed files with 15 additions and 1 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue