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§
Sourcefn consensus_serialize<W>(&self, fd: &mut W) -> Result<(), Error>
fn consensus_serialize<W>(&self, fd: &mut W) -> Result<(), Error>
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>
Provided Methods§
Implementations on Foreign Types§
Source§impl StacksMessageCodec for (ConsensusHash, BurnchainHeaderHash)
impl StacksMessageCodec for (ConsensusHash, BurnchainHeaderHash)
fn consensus_serialize<W>(&self, fd: &mut W) -> Result<(), Error>where
W: Write,
fn consensus_deserialize<R>(
fd: &mut R,
) -> Result<(ConsensusHash, BurnchainHeaderHash), Error>where
R: Read,
Source§impl StacksMessageCodec for i64
impl StacksMessageCodec for i64
Source§impl StacksMessageCodec for u8
impl StacksMessageCodec for u8
Source§impl StacksMessageCodec for u16
impl StacksMessageCodec for u16
Source§impl StacksMessageCodec for u32
impl StacksMessageCodec for u32
Source§impl StacksMessageCodec for u64
impl StacksMessageCodec for u64
Source§impl StacksMessageCodec for [u8; 20]
impl StacksMessageCodec for [u8; 20]
Source§impl StacksMessageCodec for [u8; 32]
impl StacksMessageCodec for [u8; 32]
Source§impl<T> StacksMessageCodec for Vec<T>where
T: StacksMessageCodec,
impl<T> StacksMessageCodec for Vec<T>where
T: StacksMessageCodec,
Implementors§
impl StacksMessageCodec for Value
Note: the StacksMessageCodec implementation for Clarity values does not sanitize its serialization or deserialization.