about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorChris Morgan <me@chrismorgan.info>2013-08-16 20:17:02 +1000
committerChris Morgan <me@chrismorgan.info>2013-08-16 20:17:02 +1000
commit14885dade4a70f9e32fac7d9387e34fbb5361990 (patch)
treebe562b138ffb24d40ec292a462af0d44798f26c9 /src/libstd
parent92af0db0a3919f5371de362cb6060ff87190aafe (diff)
downloadrust-14885dade4a70f9e32fac7d9387e34fbb5361990.tar.gz
rust-14885dade4a70f9e32fac7d9387e34fbb5361990.zip
Implement DeepClone for str types.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/str.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/libstd/str.rs b/src/libstd/str.rs
index a759b8cbd62..88345effc01 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 {