[−][src]Derive Macro exonum_derive::FromAccess
#[derive(FromAccess)] { // Attributes available to this derive: #[from_access] }
Derives FromAccess
trait.
This macro can be applied only to struct
s, each field of which implements FromAccess
itself (e.g., indexes, Group
s, or Lazy
indexes). The macro instantiates each field
using the address created by appending a dot .
and the name of the field or its override
(see below) to the root address where the struct is created. For example,
if the struct is created at the address "foo"
and has fields "list"
and "map"
, they
will be instantiated at addresses "foo.list"
and "foo.map"
, respectively.
The struct must have at least one type param, which will correspond to the Access
type.
The derive logic will determine this param as the first param with T: Access
bound.
If there are no such params, but there is a single type param, it will be used.
Container Attributes
transparent
#[from_access(transparent)]`
Switches to the transparent layout similarly to #[repr(transparent)]
or #[serde(transparent)]
.
A struct with the transparent layout must have a single field. The field will be created at
the same address as the struct itself (i.e., no suffix will be added).
Field Attributes
rename
#[from_access(rename = "name")]
Changes the suffix appended to the address when creating a field. The name should follow conventions for index names.