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) -> Vec<u8> ⓘ { ... }
fn consensus_encode_to_hex(&self) -> String { ... }
fn consensus_encode_to_len(&self) -> usize { ... }
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) -> Vec<u8> ⓘ
fn consensus_encode_to_vec(&self) -> Vec<u8> ⓘ
Self::consensus_encode
to newly allocated Vec<u8>
sourcefn consensus_encode_to_hex(&self) -> String
fn consensus_encode_to_hex(&self) -> String
Encode and convert to hex string representation
sourcefn consensus_encode_to_len(&self) -> usize
fn consensus_encode_to_len(&self) -> usize
Encode without storing the encoding, return the size
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.