pub unsafe fn read_struct<T>(buffer: &[u8], offset: usize) -> Twhere
T: Copy,Expand description
Helper to safely read a struct from a byte buffer at an offset
ยงSafety
Caller must ensure:
- offset +
size_of::<T>() <= buffer.len() - Buffer is properly aligned for T
- Bytes represent a valid T