Skip to content

Commit 14885da

Browse files
committed
Implement DeepClone for str types.
1 parent 92af0db commit 14885da

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/libstd/str.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use at_vec;
2020
use cast;
2121
use char;
2222
use char::Char;
23-
use clone::Clone;
23+
use clone::{Clone, DeepClone};
2424
use container::{Container, Mutable};
2525
use iter::Times;
2626
use iterator::{Iterator, FromIterator, Extendable};
@@ -2104,13 +2104,27 @@ impl Clone for ~str {
21042104
}
21052105
}
21062106
2107+
impl DeepClone for ~str {
2108+
#[inline]
2109+
fn deep_clone(&self) -> ~str {
2110+
self.to_owned()
2111+
}
2112+
}
2113+
21072114
impl Clone for @str {
21082115
#[inline]
21092116
fn clone(&self) -> @str {
21102117
*self
21112118
}
21122119
}
21132120
2121+
impl DeepClone for @str {
2122+
#[inline]
2123+
fn deep_clone(&self) -> @str {
2124+
*self
2125+
}
2126+
}
2127+
21142128
impl FromIterator<char> for ~str {
21152129
#[inline]
21162130
fn from_iterator<T: Iterator<char>>(iterator: &mut T) -> ~str {

0 commit comments

Comments
 (0)