/// Copy slice of bytes only /// /// # Notes /// `dst` and `src` must not overlap. See [move_slice]. pub fn copy_slice(dst: &mut [u8], src: &[u8]) -> usize { let sz = std::cmp::min(dst.len(),src.len()); unsafe { std::ptr::copy(&src[0] as *const u8, &mut dst[0] as *mut u8, sz); } sz } /// Move slice of bytes only /// /// # Notes /// `dst` and `src` can overlap. pub fn move_slice(dst: &mut [u8], src: &[u8]) -> usize { let sz = std::cmp::min(dst.len(),src.len()); unsafe { std::ptr::copy(&src[0] as *const u8, &mut dst[0] as *mut u8, sz); } sz }