Crate near_sdk_macros[][src]

Macros

metadata

metadata generates the metadata method and should be placed at the very end of the lib.rs file. TODO: Once Rust allows inner attributes and custom procedural macros for modules we should switch this to be #![metadata] attribute at the top of the contract file instead. https://github.com/rust-lang/rust/issues/54727

Attribute Macros

callback

callback is a marker attribute it does not generate code by itself.

callback_vec

callback_args_vec is a marker attribute it does not generate code by itself.

ext_contract
init

init is a marker attribute it does not generate code by itself.

near_bindgen
result_serializer

result_serializer is a marker attribute it does not generate code by itself.

serializer

serializer is a marker attribute it does not generate code by itself.

Derive Macros

BorshStorageKey

BorshStorageKey generates implementation for BorshIntoStorageKey trait. It allows the type to be passed as a unique prefix for persistent collections. The type should also implement or derive BorshSerialize trait.

PanicOnDefault

PanicOnDefault generates implementation for Default trait that panics with the following message The contract is not initialized when default() is called. This is a helpful macro in case the contract is required to be initialized with either init or init(ignore_state).