impl clone_from for ArrayVec and ArrayString

This commit is contained in:
bluss
2016-02-06 01:33:58 +01:00
parent a5f63d3191
commit a17c764f98
3 changed files with 73 additions and 0 deletions
+6
View File
@@ -225,4 +225,10 @@ impl<A: Array<Item=u8> + Copy> Clone for ArrayString<A> {
fn clone(&self) -> ArrayString<A> {
*self
}
fn clone_from(&mut self, rhs: &Self) {
// guaranteed to fit due to types matching.
self.clear();
self.push_str(rhs).ok();
}
}