Derive Macro bytemuck::ByteHash

source ·
#[derive(ByteHash)]
Expand description

Derive the Hash trait for a type

The macro implements Hash by casting the value to a byte slice and hashing that.

Warning

The hash does not match the standard library’s Hash derive.

Example

#[derive(Copy, Clone, NoUninit, ByteHash)]
#[repr(C)]
struct Test {
  a: u32,
  b: char,
  c: f32,
}