From c9abc01a985a7634b8fc73d9862ecea6181c3c11 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 6 Aug 2014 20:17:03 -0700 Subject: [PATCH] core: Rename MutableCloneableSlice::copy_from to clone_from_slice Deprecate the previous. --- src/libcore/slice.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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); }