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) -> Result<Vec<u8>, Error>

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

fn consensus_encode_to_hex(&self) -> Result<String, Error>

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) -> Result<Vec<u8>, Error>

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

fn consensus_encode_to_hex(&self) -> Result<String, Error>

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,