[][src]Function triple_accel::fill_str

pub fn fill_str(dest: &mut [u8], src: &[u8])

Directly copy from the a source u8 slice to a destination u8 slice.

Can be used to copy string data after allocating a vector using alloc_str.

Arguments

  • dest - the destination slice
  • src - the source slice

Panics

  • If the length of src is greater than the length of dest.

Example

let mut a = vec![0u8; 5];
let b = vec![1u8, 2u8, 3u8, 4u8];

fill_str(&mut a, &b);

assert!(a == vec![1u8, 2u8, 3u8, 4u8, 0u8]);