Skip to main content

ToFeltRepr

Derive Macro ToFeltRepr 

Source
#[derive(ToFeltRepr)]
Expand description

Derives ToFeltRepr trait for a struct with named fields, or an enum.

Structs are encoded by serializing their fields in declaration order.

Enums are encoded as a u32 tag (variant ordinal, starting from 0) followed by the selected variant payload encoded in declaration order.

§Example

use miden_field_repr::ToFeltRepr;

#[derive(ToFeltRepr)]
pub struct AccountId {
    pub prefix: Felt,
    pub suffix: Felt,
}