Skip to main content

slice_as_bytes

Function slice_as_bytes 

Source
pub fn slice_as_bytes<T>(buf: &[T]) -> &[u8] 
Expand description

Reinterpret a slice of any type as a shared &[u8].

SAFETY: the slice covers exactly size_of_val(buf) bytes starting at the same address. u8 has no alignment requirement, so any T is valid.