Trait fedimint_core::encoding::DynEncodable

source ·
pub trait DynEncodable {
    // Required method
    fn consensus_encode_dyn(
        &self,
        writer: &mut dyn Write,
    ) -> Result<usize, Error>;
}
Expand description

Object-safe trait for things that can encode themselves

Like rust-bitcoin’s consensus_encode, but without generics, so can be used in dyn objects.

Required Methods§

source

fn consensus_encode_dyn(&self, writer: &mut dyn Write) -> Result<usize, Error>

Trait Implementations§

source§

impl Encodable for Box<dyn DynEncodable>

source§

fn consensus_encode<W: Write>(&self, writer: &mut W) -> Result<usize, Error>

Encode an object with a well-defined format. Returns the number of bytes written on success. Read more
source§

fn consensus_encode_to_vec(&self) -> Vec<u8>

Self::consensus_encode to newly allocated Vec<u8>
source§

fn consensus_encode_to_hex(&self) -> String

Encode and convert to hex string representation
source§

fn consensus_encode_to_len(&self) -> usize

Encode without storing the encoding, return the size
source§

fn consensus_hash<H>(&self) -> H
where H: Hash, H::Engine: Write,

Generate a SHA256 hash of the consensus encoding using the default hash engine for H. Read more
source§

impl Encodable for dyn DynEncodable

source§

fn consensus_encode<W: Write>(&self, writer: &mut W) -> Result<usize, Error>

Encode an object with a well-defined format. Returns the number of bytes written on success. Read more
source§

fn consensus_encode_to_vec(&self) -> Vec<u8>

Self::consensus_encode to newly allocated Vec<u8>
source§

fn consensus_encode_to_hex(&self) -> String

Encode and convert to hex string representation
source§

fn consensus_encode_to_len(&self) -> usize

Encode without storing the encoding, return the size
source§

fn consensus_hash<H>(&self) -> H
where H: Hash, H::Engine: Write,

Generate a SHA256 hash of the consensus encoding using the default hash engine for H. Read more

Implementors§

source§

impl<T> DynEncodable for T
where T: Encodable,