Derive Macro bytemuck::Pod [−][src]
#[derive(Pod)]
Expand description
Derive the Pod
trait for a struct
The macro ensures that the struct follows all the the safety requirements
for the Pod
trait.
The following constraints need to be satisfied for the macro to succeed
- All fields in the struct must implement
Pod
- The struct must be
#[repr(C)]
or#[repr(transparent)]
- The struct must not contain any padding bytes
- The struct contains no generic parameters
Example
#[derive(Copy, Clone, Pod, Zeroable)] #[repr(C)] struct Test { a: u16, b: u16, }