Function lazy_bytes_cast::to::bytes [] [src]

pub fn bytes<T: Copy>(data: T) -> Vec<u8>

Converts data to a byte array.

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.

Note 2:

This function is not available without libstd for obvious reasons.

Parameters:

  • data - Arbitrary data that can be memcpy

Result:

  • Vec - Allocated with size equal to size_of::<data>.