exonum_proto

Trait ProtobufConvert

Source
pub trait ProtobufConvert: Sized {
    type ProtoStruct;

    // Required methods
    fn to_pb(&self) -> Self::ProtoStruct;
    fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>;
}
Expand description

Used for establishing correspondence between a Rust struct and a type generated from Protobuf.

Required Associated Types§

Source

type ProtoStruct

Type generated from the Protobuf definition.

Required Methods§

Source

fn to_pb(&self) -> Self::ProtoStruct

Performs conversion to the type generated from Protobuf.

Source

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Performs conversion from the type generated from Protobuf.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ProtobufConvert for bool

Source§

impl ProtobufConvert for f32

Source§

impl ProtobufConvert for f64

Source§

impl ProtobufConvert for i16

Source§

impl ProtobufConvert for i32

Source§

impl ProtobufConvert for i64

Source§

impl ProtobufConvert for u16

Source§

impl ProtobufConvert for u32

Source§

impl ProtobufConvert for u64

Source§

impl ProtobufConvert for ()

Source§

impl ProtobufConvert for String

Source§

impl ProtobufConvert for Vec<u8>

Special case for protobuf bytes.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for BitVec

Source§

impl ProtobufConvert for DateTime<Utc>

Source§

impl ProtobufConvert for [u8; 8]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 16]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 24]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 32]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 40]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 48]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 56]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 64]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 72]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 80]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 88]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 96]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 104]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 112]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 120]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 128]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 160]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 256]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 512]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 1024]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl ProtobufConvert for [u8; 2048]

Special case for fixed sized arrays.

Source§

type ProtoStruct = Vec<u8>

Source§

fn to_pb(&self) -> Self::ProtoStruct

Source§

fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>

Source§

impl<K, T, S> ProtobufConvert for HashMap<K, T, S>

Source§

impl<T> ProtobufConvert for Vec<T>
where T: ProtobufConvert,

Implementors§