Derive Macro bytemuck::Zeroable

source ·
#[derive(Zeroable)]
Expand description

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 in the struct must to implement Zeroable

Example


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