macro_rules! impl_component {
($struct_name:ident, $symbol:expr, $storage:ident, { $( $field:ident : $ftype:tt ),* $(,)? }) => { ... };
}Expand description
Implement ComponentTrait for a struct with fixed-size fields.
Generates serialization/deserialization using big-endian byte encoding.
§Supported field types
i32 (4 bytes), u32 (4 bytes), i64 (8 bytes), u64 (8 bytes),
i128 (16 bytes), u128 (16 bytes), u8 (1 byte), bool (1 byte),
bytes32 (32 bytes — use for BytesN<32> fields)
§Note
The symbol name must be at most 9 characters (Soroban symbol_short! limit).
§Example
use cougr_core::impl_component;
use soroban_sdk::contracttype;
#[contracttype]
#[derive(Clone, Debug)]
pub struct Position {
pub x: i32,
pub y: i32,
}
impl_component!(Position, "position", Table, { x: i32, y: i32 });