Function lazy_bytes_cast::to::copy_bytes [] [src]

pub fn copy_bytes<T: Copy>(data: T, to: &mut [u8]) -> Result<(), ()>

Converts data to a byte array by writing it into mutable slice

Note:

This function limits its usage to data that implements marker::Copy

But it does not guarantee that all types with such trait will be correctly converted.

Parameters:

  • data - Arbitrary data that can be memcpy
  • to - Byte slice where to copy

Result:

  • Ok - Success.
  • Err - Insufficient slice size.