#[derive(Encode)]
{
// Attributes available to this derive:
#[senax]
}
Expand description
Derive macro for implementing the Encode trait
This procedural macro automatically generates an implementation of the Encode trait
for structs and enums. It supports various field attributes for customizing the
encoding behavior.
§Supported Attributes
§Container-level attributes:
#[senax(disable_encode)]- Generate stub implementation (unimplemented!() only) for Encode/Decode
§Field-level attributes:
#[senax(id=N)]- Set explicit field/variant ID#[senax(skip_encode)]- Skip field during encoding#[senax(rename="name")]- Use alternative name for ID calculation
§Examples
#[derive(Encode)]
struct MyStruct {
#[senax(id=1)]
field1: i32,
#[senax(skip_encode)]
field2: String,
}
// Stub implementation for faster compilation during development
#[derive(Encode, Decode)]
#[senax(disable_encode)]
struct UnfinishedStruct {
#[senax(id=1)]
field1: i32,
}