Trait clarity_repl::clarity::codec::StacksMessageCodec
pub trait StacksMessageCodec {
// Required methods
fn consensus_serialize<W>(&self, fd: &mut W) -> Result<(), Error>
where W: Write,
Self: Sized;
fn consensus_deserialize<R>(fd: &mut R) -> Result<Self, Error>
where R: Read,
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§
fn consensus_serialize<W>(&self, fd: &mut W) -> Result<(), Error>where
W: Write,
Self: Sized,
fn consensus_serialize<W>(&self, fd: &mut W) -> Result<(), Error>where W: Write, Self: Sized,
serialize implementors should never error unless there is an underlying
failure in writing to the fd
fn consensus_deserialize<R>(fd: &mut R) -> Result<Self, Error>where R: Read, Self: Sized,
Provided Methods§
fn serialize_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn serialize_to_vec(&self) -> Vec<u8> ⓘwhere Self: Sized,
Convenience for serialization to a vec. this function unwraps any underlying serialization error