Function rustml::vectors::copy_memory
[−]
[src]
pub fn copy_memory<T: Copy>(dst: &mut [T], src: &[T], n: usize) -> usize
Copies elements from src
to dst
.
This function copies at most n
elements from src
to dst
. If
n
is larger than the size of src
or dst
min(src.len(), dst.len()) elements
are copied. The function returns the number of elements that have been
copied.
Example
use rustml::vectors::*; let a = vec![1, 2, 3, 4]; let e = vec![1, 2, 3, 0]; let mut b = vec![0, 0, 0, 0]; copy_memory(&mut b, &a, 3); assert_eq!(b, e);
Implementation details
This function uses the C function call memcpy
to copy the memory.