Function copy_string

Source
pub unsafe fn copy_string<T: Copy>(
    string: &[T],
    buffer: *mut T,
    length: usize,
) -> Result<(), BufferOverflowError>
Expand description

Copies a string of values of a primitive data type to a buffer.

§Arguments

  • string - A reference to an string of values to copy
  • buffer - A buffer to receive the copy of the string
  • length - The length of the input buffer

§Safety

This function is unsafe because of its use of slice::from_raw_parts, which relies on the caller to not exceed the length of the buffer when generating the slice.