Trait StacksMessageCodec

Source
pub trait StacksMessageCodec {
    // Required methods
    fn consensus_serialize<W: Write>(&self, fd: &mut W) -> Result<(), Error>
       where Self: Sized;
    fn consensus_deserialize<R: Read>(fd: &mut R) -> Result<Self, Error>
       where Self: Sized;

    // Provided method
    fn serialize_to_vec(&self) -> Vec<u8> 
       where Self: Sized { ... }
}
Expand description

Helper trait for various primitive types that make up Stacks messages

Required Methods§

Source

fn consensus_serialize<W: Write>(&self, fd: &mut W) -> Result<(), Error>
where Self: Sized,

serialize implementors should never error unless there is an underlying failure in writing to the fd

Source

fn consensus_deserialize<R: Read>(fd: &mut R) -> Result<Self, Error>
where Self: Sized,

Provided Methods§

Source

fn serialize_to_vec(&self) -> Vec<u8>
where Self: Sized,

Convenience for serialization to a vec. this function unwraps any underlying serialization error

Implementations on Foreign Types§

Source§

impl StacksMessageCodec for (ConsensusHash, BurnchainHeaderHash)

Source§

impl StacksMessageCodec for i64

Source§

impl StacksMessageCodec for u8

Source§

impl StacksMessageCodec for u16

Source§

impl StacksMessageCodec for u32

Source§

impl StacksMessageCodec for u64

Source§

impl StacksMessageCodec for [u8; 20]

Source§

impl StacksMessageCodec for [u8; 32]

Source§

impl<T> StacksMessageCodec for Vec<T>

Implementors§