2 releases

0.0.0 Aug 6, 2019
0.0.0-sol9 Jul 26, 2019
0.0.0-sol15 Jul 27, 2019

#36 in #libra


Used in 18 crates (via solana_libra_proto_conv)

Apache-2.0

9KB
150 lines

The FromProto and IntoProto macros provide an easy way to convert Rust struct to corresponding Protobuf struct, or vice versa. For example:

#[derive(FromProto, IntoProto)]
#[ProtoType(ProtobufStruct)]
struct RustStruct {
    field1: Field1,
    field2: Field2,
    ...
    fieldn: FieldN,
}

It requires that all fields (Field1, Field2, ..., FieldN) implement FromProto trait if we want to derive FromProto for RustStruct. Same for IntoProto trait.

Dependencies

~2MB
~48K SLoC