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§
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) -> Result<Vec<u8>, Error>
fn consensus_encode_to_vec(&self) -> Result<Vec<u8>, Error>
Self::consensus_encode
to newly allocated Vec<u8>
fn consensus_encode_to_hex(&self) -> Result<String, Error>
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) -> Result<Vec<u8>, Error>
fn consensus_encode_to_vec(&self) -> Result<Vec<u8>, Error>
Self::consensus_encode
to newly allocated Vec<u8>