Derive Macro concordium_std::DeserialWithState
source · #[derive(DeserialWithState)]
{
// Attributes available to this derive:
#[concordium]
}
Expand description
Derive the DeserialWithState trait. See the documentation of
derive(Deserial)
for details and limitations.
This trait should be derived for struct
s or enum
s that have fields with
StateBox
,
StateSet
, or
StateMap
. Please note that it is
necessary to specify the generic parameter name for the
HasStateApi
generic parameter.
To do so, use the #[concordium(state_parameter = "NameOfGenericParameter")]
attribute on the type you are deriving
DeserialWithState
for.
Example
ⓘ
#[derive(DeserialWithState)]
#[concordium(state_parameter = "S")]
struct Foo<S, T> {
a: StateMap<u8, u8, S>,
#[concordium(size_length = 1)]
b: String,
c: Vec<T>,
}