pub trait Protobuf<Raw: Message + Default>where
    Self: TryFrom<Raw> + CloneInto<Raw>,
    <Self as TryFrom<Raw>>::Error: Display,{
    // Provided methods
    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) -> Vec<u8> { ... }
    fn decode_vec(v: &[u8]) -> Result<Self, Error>
       where Self: Sized { ... }
    fn encode_length_delimited_vec(&self) -> Vec<u8> { ... }
    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§

source

fn encode(&self, buf: &mut Vec<u8>) -> Result<(), Error>

Encode into a buffer in Protobuf format.

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

source

fn encode_length_delimited(&self, buf: &mut Vec<u8>) -> Result<(), Error>

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.

source

fn decode<B: Buf>(buf: B) -> Result<Self, Error>where Self: Sized,

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.

source

fn decode_length_delimited<B: Buf>(buf: B) -> Result<Self, Error>where Self: Sized,

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.

source

fn encoded_len(&self) -> usize

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

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

source

fn encode_vec(&self) -> Vec<u8>

Encodes into a Protobuf-encoded Vec<u8>.

source

fn decode_vec(v: &[u8]) -> Result<Self, Error>where Self: Sized,

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

source

fn encode_length_delimited_vec(&self) -> Vec<u8>

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

source

fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>where Self: Sized,

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

source

fn encode_to_hex_string(&self) -> String

Implementors§