core: Rename MutableCloneableSlice::copy_from to clone_from_slice

Deprecate the previous.
This commit is contained in:
Brian Anderson 2014-08-06 20:17:03 -07:00
parent d4c736b1f0
commit c9abc01a98

View File

@ -837,6 +837,12 @@ impl<'a, T: Ord> ImmutableOrdSlice<T> for &'a [T] {
/// Trait for &[T] where T is Cloneable
pub trait MutableCloneableSlice<T> {
/// 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<T> {
/// 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<T> 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);
}