[][src]Trait tendermint_proto::DomainType

pub trait DomainType<T: Message + From<Self> + Default> where
    Self: Sized + Clone + TryFrom<T>,
    Self::Error: Into<BoxError>, 
{ fn encode<B: BufMut>(&self, buf: &mut B) -> Result<(), Error> { ... }
fn encode_length_delimited<B: BufMut>(
        &self,
        buf: &mut B
    ) -> Result<(), Error> { ... }
fn decode<B: Buf>(buf: B) -> Result<Self, Error> { ... }
fn decode_length_delimited<B: Buf>(buf: B) -> Result<Self, Error> { ... }
fn encoded_len(&self) -> usize { ... }
fn encode_vec(&self) -> Result<Vec<u8>, Error> { ... }
fn decode_vec(v: &[u8]) -> Result<Self, Error> { ... }
fn encode_length_delimited_vec(&self) -> Result<Vec<u8>, Error> { ... }
fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error> { ... } }

DomainType trait allows protobuf encoding and decoding for domain types

Provided methods

fn encode<B: BufMut>(&self, buf: &mut B) -> Result<(), Error>

Encodes the DomainType into a buffer.

This function replaces the Prost::Message encode() function for DomainTypes.

fn encode_length_delimited<B: BufMut>(&self, buf: &mut B) -> Result<(), Error>

Encodes the DomainType with a length-delimiter to a buffer.

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

This function replaces the Prost::Message encode_length_delimited() function for DomainTypes.

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

Decodes an instance of the message from a buffer and then converts it into DomainType.

The entire buffer will be consumed.

This function replaces the Prost::Message decode() function for DomainTypes.

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

Decodes a length-delimited instance of the message from the buffer.

The entire buffer will be consumed.

This function replaces the Prost::Message decode_length_delimited() function for DomainTypes.

fn encoded_len(&self) -> usize

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

This function replaces the Prost::Message encoded_len() function for DomainTypes.

fn encode_vec(&self) -> Result<Vec<u8>, Error>

Encodes the DomainType into a protobuf-encoded Vec

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

Decodes a protobuf-encoded instance of the message from a Vec and then converts it into DomainType.

fn encode_length_delimited_vec(&self) -> Result<Vec<u8>, Error>

Encodes the DomainType with a length-delimiter to a Vec protobuf-encoded message.

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

Decodes a protobuf-encoded instance of the message with a length-delimiter from a Vec and then converts it into DomainType.

Loading content...

Implementors

Loading content...