Expand description
Derive macros for SSZ Encode, Decode, and HashTreeRoot traits.
§Struct example
ⓘ
#[derive(Encode, Decode, HashTreeRoot)]
struct MyStruct {
fixed_field: u32,
var_field: ssz::List<u8, 1024>,
#[ssz(skip)]
cached: u64,
}§Newtype passthrough
ⓘ
#[derive(Encode, Decode, HashTreeRoot)]
struct SlotIdx(#[ssz(transparent)] NonZeroU32);§Enum example (SSZ Union)
ⓘ
#[derive(Encode, Decode, HashTreeRoot)]
enum Cap {
#[ssz(selector = 0)]
Instance(InstanceCap),
#[ssz(selector = 1)]
Image(ImageCap),
}Derive Macros§
- Decode
- Derive the
ssz::Decodetrait for a struct or enum. - Encode
- Derive the
ssz::Encodetrait for a struct or enum. - Hash
Tree Root - Derive the
ssz::HashTreeRoottrait for a struct or enum.