read_struct_slice

Function read_struct_slice 

Source
pub unsafe fn read_struct_slice<T>(
    buffer: &[u8],
    offset: usize,
    count: usize,
) -> &[T]
where T: Copy,
Expand description

Helper to safely read a slice of structs from a byte buffer

ยงSafety

Caller must ensure:

  • offset + size_of::<T>() * count <= buffer.len()
  • Buffer contains valid T values