Skip to main content

MoveStruct

Derive Macro MoveStruct 

Source
#[derive(MoveStruct)]
{
    // Attributes available to this derive:
    #[move_struct]
}
Available on crate feature macros only.
Expand description

Derive macro for Move-compatible struct serialization.

Implements BCS serialization and the necessary traits for using a Rust struct as a Move struct argument or return type.

§Example

use aptos_sdk_macros::MoveStruct;

#[derive(MoveStruct)]
#[move_struct(address = "0x1", module = "coin", name = "CoinStore")]
pub struct CoinStore {
    pub coin: u64,
    pub frozen: bool,
}