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§
Trait Implementations§
Source§impl Encodable for Box<dyn DynEncodable>
impl Encodable for Box<dyn DynEncodable>
Source§fn consensus_encode<W: Write>(&self, writer: &mut W) -> Result<usize, Error>
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> ⓘ
fn consensus_encode_to_vec(&self) -> Vec<u8> ⓘ
Self::consensus_encode
to newly allocated Vec<u8>
Source§fn consensus_encode_to_hex(&self) -> String
fn consensus_encode_to_hex(&self) -> String
Encode and convert to hex string representation
Source§fn consensus_encode_to_len(&self) -> usize
fn consensus_encode_to_len(&self) -> usize
Encode without storing the encoding, return the size
Source§impl Encodable for dyn DynEncodable
impl Encodable for dyn DynEncodable
Source§fn consensus_encode<W: Write>(&self, writer: &mut W) -> Result<usize, Error>
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> ⓘ
fn consensus_encode_to_vec(&self) -> Vec<u8> ⓘ
Self::consensus_encode
to newly allocated Vec<u8>
Source§fn consensus_encode_to_hex(&self) -> String
fn consensus_encode_to_hex(&self) -> String
Encode and convert to hex string representation
Source§fn consensus_encode_to_len(&self) -> usize
fn consensus_encode_to_len(&self) -> usize
Encode without storing the encoding, return the size