Skip to main content

Decode

Derive Macro Decode 

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

Derives the Decode trait for a struct or enum.

For structs, decodes each field in declaration order.

For enums, reads a VarInt discriminant and decodes the matching variant. Returns Error::InvalidData for unknown discriminants.

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