Skip to main content

EncodedSize

Derive Macro EncodedSize 

Source
#[derive(EncodedSize)]
{
    // Attributes available to this derive:
    #[field]
    #[variant]
}
Expand description

Derives the EncodedSize trait for a struct or enum.

For structs, sums the encoded size of each field.

For enums, returns the VarInt discriminant size plus the matched variant’s fields size.

For packet structs, use #[packet(id = N)] instead.