From 14885dade4a70f9e32fac7d9387e34fbb5361990 Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Fri, 16 Aug 2013 20:17:02 +1000 Subject: [PATCH] Implement DeepClone for str types. --- src/libstd/str.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/libstd/str.rs b/src/libstd/str.rs index a759b8cbd623..88345effc019 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 for ~str { #[inline] fn from_iterator>(iterator: &mut T) -> ~str {