diff options
| author | Andrew Paseltiner <apaseltiner@gmail.com> | 2015-09-23 08:49:50 -0400 |
|---|---|---|
| committer | Andrew Paseltiner <apaseltiner@gmail.com> | 2015-09-23 10:32:58 -0400 |
| commit | e9946f99b97fa1efda39b657448aae0238b66220 (patch) | |
| tree | 1f4b6ae9fba7fd14976bf2de9b9234c647e71434 /src/libcollections/string.rs | |
| parent | 2a6f6f26f4d4a1e22ea5e2b4498d3245d80e8aff (diff) | |
Override `clone_from` for `{BinaryHeap, String}`
CC #28481
Diffstat (limited to 'src/libcollections/string.rs')
| -rw-r--r-- | src/libcollections/string.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index bb65d7469ab..ba921fed68b 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -30,7 +30,7 @@ use vec::Vec; use boxed::Box; /// A growable string stored as a UTF-8 encoded buffer. -#[derive(Clone, PartialOrd, Eq, Ord)] +#[derive(PartialOrd, Eq, Ord)] #[stable(feature = "rust1", since = "1.0.0")] pub struct String { vec: Vec<u8>, @@ -766,6 +766,17 @@ impl fmt::Display for FromUtf16Error { } #[stable(feature = "rust1", since = "1.0.0")] +impl Clone for String { + fn clone(&self) -> Self { + String { vec: self.vec.clone() } + } + + fn clone_from(&mut self, source: &Self) { + self.vec.clone_from(&source.vec); + } +} + +#[stable(feature = "rust1", since = "1.0.0")] impl FromIterator<char> for String { fn from_iter<I: IntoIterator<Item=char>>(iterable: I) -> String { let mut buf = String::new(); |
