[src]

Trait std::slice::MutableCloneableVector

pub trait MutableCloneableVector<T> {
    fn copy_from(self, &[T]) -> uint;
}

Trait for &[T] where T is Cloneable

Required Methods

fn copy_from(self, &[T]) -> uint

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.

Example

use std::slice::MutableCloneableVector;

let mut dst = [0, 0, 0];
let src = [1, 2];

assert!(dst.copy_from(src) == 2);
assert!(dst == [1, 2, 0]);

let src2 = [3, 4, 5, 6];
assert!(dst.copy_from(src2) == 3);
assert!(dst == [3, 4, 5]);

Implementors