diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 0eb972413071..b914a26d94c3 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -837,6 +837,12 @@ impl<'a, T: Ord> ImmutableOrdSlice for &'a [T] { /// Trait for &[T] where T is Cloneable pub trait MutableCloneableSlice { + /// Copies as many elements from `src` as it can into `self` (the + /// shorter of `self.len()` and `src.len()`). Returns the number + /// of elements copied. + #[deprecated = "renamed to clone_from_slice"] + fn copy_from(self, s: &[T]) -> uint { self.clone_from_slice(s) } + /// Copies as many elements from `src` as it can into `self` (the /// shorter of `self.len()` and `src.len()`). Returns the number /// of elements copied. @@ -856,12 +862,12 @@ pub trait MutableCloneableSlice { /// assert!(dst.copy_from(src2) == 3); /// assert!(dst == [3i, 4, 5]); /// ``` - fn copy_from(self, &[T]) -> uint; + fn clone_from_slice(self, &[T]) -> uint; } impl<'a, T:Clone> MutableCloneableSlice for &'a mut [T] { #[inline] - fn copy_from(self, src: &[T]) -> uint { + fn clone_from_slice(self, src: &[T]) -> uint { for (a, b) in self.mut_iter().zip(src.iter()) { a.clone_from(b); }