[]Derive Macro bytemuck::Zeroable

#[derive(Zeroable)]

Derive the Zeroable trait for a struct

The macro ensures that the struct follows all the the safety requirements for the Zeroable trait.

The following constraints need to be satisfied for the macro to succeed

  • All fields ind the struct must to implement Zeroable

Example


#[derive(Copy, Clone, Zeroable)]
#[repr(C)]
struct Test {
  a: u16,
  b: u16,
}