[src]

Trait std::vec::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::vec::MutableCloneableVector;

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

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

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

Implementors