#[derive(MoveStruct)]
{
// Attributes available to this derive:
#[move_]
}
Expand description
Derives af_move_type trait implementations for a type representing a Move struct.
Creates the _TypeTag struct related to the struct being annotated, with conversion traits
between the former and the dynamic StructTag type, with errors like ‘expected module to be x’
or ‘expected struct name to be y’, if we know those things at compile time (see the
Attributes section for configurations around those checks).
§Attributes
#[move_(crate = ...)]: sets the path of theaf_move_typecrate, which can be useful if using this inside other macros.#[move_(address = "...")]: sets a static package address for the derivedMoveTypeTag. Deserialization of the latter will fail if the package addresses do not match.#[move_(module = "...")]: sets a static module name for the derivedMoveTypeTag. Deserialization of the latter will fail if the module names do not match.#[move_(nameless)]: make the struct name dynamic for the derivedMoveTypeTag. Upon the deserializing the latter, any Move struct name will be accepted. Otherwise, deserialization will fail if the incoming struct name is not equal to the Rust struct’s name.
§MoveTypeTag derivation
For a struct Name<T: MoveType>, the macro will create a NameTypeTag struct with fields:
address: Address, unless the#[move_(address = "...")]attribute is presentmodule: Identifier, unless the#[move_(module = "...")]attribute is presentname: Identifieronly if the#[move_(nameless)]attribute is presentt: <T as MoveType>::TypeTag
The macro will also create custom Into<StructTag>, Into<TypeTag>, TryFrom<StructTag>,
TryFrom<TypeTag>, Display and FromStr impls for NameTypeTag.
§Derived traits
af_move_type::MoveStructaf_move_type::StaticAddressif#[move_(address = "...")]is specifiedaf_move_type::StaticModuleif#[move_(module = "...")]is specifiedaf_move_type::StaticNameif#[move_(nameless)]was not specifiedaf_move_type::StaticTypeParamsaf_move_type::StaticStructTagif applicableaf_move_type::StaticTypeTagif applicable