[−][src]Derive Macro exonum_derive::ProtobufConvert
#[derive(ProtobufConvert)] { // Attributes available to this derive: #[exonum] }
Derives ProtobufConvert
trait.
Attributes:
-
#[exonum( pb = "path" )]
Required.path
is the name of the corresponding protobuf generated struct. -
#[exonum( crate = "path" )]
Optional.path
is prefix of theexonum
crate(usually "crate" or "exonum"). -
#[exonum( serde_pb_convert )]
Optional. Implementsserde::{Serialize, Deserialize}
using structs that were generated with protobuf. For example, it should be used if you want json representation of your struct to be compatible with protobuf representation (including proper nesting of fields).
// For example, struct with `exonum::crypto::Hash` with this
// (de)serializer will be represented as
StructName {
"hash": {
data: [1, 2, ...]
},
// ...
}
// With default (de)serializer.
StructName {
"hash": "12af..." // HEX
// ...
}