pub trait Protobuf<Raw: Message + Default>where
    Self: TryFrom<Raw> + CloneInto<Raw>,
    <Self as TryFrom<Raw>>::Error: Display,
{ fn encode(&self, buf: &mut Vec<u8>) -> Result<(), Error> { ... } fn encode_length_delimited(&self, buf: &mut Vec<u8>) -> Result<(), Error> { ... } fn decode<B: Buf>(buf: B) -> Result<Self, Error>
    where
        Self: Sized
, { ... } fn decode_length_delimited<B: Buf>(buf: B) -> Result<Self, Error>
    where
        Self: Sized
, { ... } fn encoded_len(&self) -> usize { ... } fn encode_vec(&self) -> Result<Vec<u8>, Error> { ... } fn decode_vec(v: &[u8]) -> Result<Self, Error>
    where
        Self: Sized
, { ... } fn encode_length_delimited_vec(&self) -> Result<Vec<u8>, Error> { ... } fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>
    where
        Self: Sized
, { ... } fn encode_to_hex_string(&self) -> String { ... } }
Expand description

Object safe equivalent of tendermint_proto::Protobuf.

Provided Methods

Encode into a buffer in Protobuf format.

Uses prost::Message::encode after converting into its counterpart Protobuf data structure.

Encode with a length-delimiter to a buffer in Protobuf format.

An error will be returned if the buffer does not have sufficient capacity.

Uses prost::Message::encode_length_delimited after converting into its counterpart Protobuf data structure.

Constructor that attempts to decode an instance from a buffer.

The entire buffer will be consumed.

Similar to prost::Message::decode but with additional validation prior to constructing the destination type.

Constructor that attempts to decode a length-delimited instance from the buffer.

The entire buffer will be consumed.

Similar to prost::Message::decode_length_delimited but with additional validation prior to constructing the destination type.

Returns the encoded length of the message without a length delimiter.

Uses prost::Message::encoded_len after converting to its counterpart Protobuf data structure.

Encodes into a Protobuf-encoded Vec<u8>.

Constructor that attempts to decode a Protobuf-encoded instance from a Vec<u8> (or equivalent).

Encode with a length-delimiter to a Vec<u8> Protobuf-encoded message.

Constructor that attempts to decode a Protobuf-encoded instance with a length-delimiter from a Vec<u8> or equivalent.

Implementors