use super::*; use std::cmp; use std::ptr; /// Copy bytes from one slice to another. /// /// # Notes /// The slices can overlap. #[inline] pub fn move_bytes(from: &[u8], to: &mut [u8]) -> usize { let len = cmp::min(from.len(), to.len()); unsafe { ptr::copy(from.as_ptr(), to.as_mut_ptr(), len); } len } /// Copy bytes from one slice to another. /// /// # Notes /// The slices must *not* overlap. #[inline] pub fn copy_bytes(from: &[u8], to: &mut [u8]) -> usize { let len = cmp::min(from.len(), to.len()); unsafe { ptr::copy_nonoverlapping(from.as_ptr(), to.as_mut_ptr(), len); } len }