Trait fedimint_core::encoding::Encodable
source · pub trait Encodable {
// Required method
fn consensus_encode<W: Write>(&self, writer: &mut W) -> Result<usize, Error>;
// Provided methods
fn consensus_encode_to_vec(&self) -> Result<Vec<u8>, Error> { ... }
fn consensus_encode_to_hex(&self) -> Result<String, Error> { ... }
fn consensus_hash<H>(&self) -> H
where H: Hash,
H::Engine: Write { ... }
}Expand description
Data which can be encoded in a consensus-consistent way
Required Methods§
Provided Methods§
sourcefn 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>
sourcefn consensus_hash<H>(&self) -> H
fn consensus_hash<H>(&self) -> H
Generate a SHA256 hash of the consensus encoding using the default hash
engine for H.
Can be used to validate all federation members agree on state without revealing the object
Object Safety§
This trait is not object safe.