diff options
| author | Chris Morgan <me@chrismorgan.info> | 2013-08-16 20:17:02 +1000 |
|---|---|---|
| committer | Chris Morgan <me@chrismorgan.info> | 2013-08-16 20:17:02 +1000 |
| commit | 14885dade4a70f9e32fac7d9387e34fbb5361990 (patch) | |
| tree | be562b138ffb24d40ec292a462af0d44798f26c9 /src/libstd | |
| parent | 92af0db0a3919f5371de362cb6060ff87190aafe (diff) | |
| download | rust-14885dade4a70f9e32fac7d9387e34fbb5361990.tar.gz rust-14885dade4a70f9e32fac7d9387e34fbb5361990.zip | |
Implement DeepClone for str types.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/str.rs | 16 |
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 { |
