[][src]Trait veriform::message::Message

pub trait Message {
    fn decode<D>(decoder: &mut Decoder<D>, input: &[u8]) -> Result<Self, Error>
    where
        D: Digest,
        Self: Sized
;
fn encode<'a>(&self, buffer: &'a mut [u8]) -> Result<&'a [u8], Error>;
fn encoded_len(&self) -> usize; fn encode_vec(&self) -> Result<Vec<u8>, Error> { ... } }

Veriform messages.

This trait provides the primary API for encoding/decoding messages as Veriform.

It's not intended to be implemented directly, but instead derived using the veriform::Message procedural macro.

Required methods

fn decode<D>(decoder: &mut Decoder<D>, input: &[u8]) -> Result<Self, Error> where
    D: Digest,
    Self: Sized

Decode a Veriform message contained in the provided slice using the given Decoder.

fn encode<'a>(&self, buffer: &'a mut [u8]) -> Result<&'a [u8], Error>

Encode this message as Veriform into the provided buffer, returning a slice containing the encoded message on success.

fn encoded_len(&self) -> usize

Get the length of a message after being encoded as Veriform.

Loading content...

Provided methods

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

Encode this message as Veriform, allocating returning a byte vector on success.

Loading content...

Implementors

impl Message for Timestamp[src]

impl Message for Uuid[src]

Loading content...