Attribute Macros§
- If
wasm-test
feature ofconcordium-std
is enabled ignore the item, this usually happens when executing tests withcargo-concordium
utility. Otherwise this is equivalent to#[cfg(not(test))]
. Use as a dual to#[concordium_cfg_test]
. - Sets the cfg for testing targeting either Wasm and native.
- Derive the appropriate export for an annotated test function, when feature “wasm-test” is enabled, otherwise behaves like
#[test]
. - Derive the appropriate export for an annotated init function.
- Derive the appropriate export for an annotated receive function.
Derive Macros§
- Derive the Deletable trait. See the documentation of
derive(Deletable)
for details and limitations. - Derive the Deserial trait. See the documentation of
derive(Serial)
for details and limitations. - Derive the DeserialWithState trait. See the documentation of
derive(Deserial)
for details and limitations. - Derive the conversion of enums that represent error types into the Reject struct which can be used as the error type of init and receive functions. Creating custom enums for error types can provide meaningful error messages to the user of the smart contract.
- Derive the
SchemaType
trait for a type with aschema::Type
matching the implementation when derivingSerial
. - Derive the
Serial
trait for the type. - A helper macro to derive both the Serial and Deserial traits.
[derive(Serialize)]
is equivalent to[derive(Serial, Deserial)]
, see documentation of the latter two for details and options:derive(Serial)
,derive(Deserial)
.