fedimint_core::encoding

Trait 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§

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.

The only errors returned are errors propagated from the writer.

Provided Methods§

Source

fn consensus_encode_to_vec(&self) -> Vec<u8>

Self::consensus_encode to newly allocated Vec<u8>

Source

fn consensus_encode_to_hex(&self) -> String

Encode and convert to hex string representation

Source

fn consensus_encode_to_len(&self) -> usize

Encode without storing the encoding, return the size

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.

Can be used to validate all federation members agree on state without revealing the object

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Encodable for &str

Source§

impl Encodable for Cow<'static, str>

Source§

impl Encodable for bool

Source§

impl Encodable for u8

Source§

impl Encodable for u16

Source§

impl Encodable for u32

Source§

impl Encodable for u64

Source§

impl Encodable for ()

Source§

fn consensus_encode<W: Write>(&self, _writer: &mut W) -> Result<usize, Error>

Source§

impl Encodable for Box<dyn DynEncodable>

Source§

impl Encodable for String

Source§

impl Encodable for Duration

Source§

impl Encodable for SystemTime

Source§

impl Encodable for Address<NetworkUnchecked>

Source§

impl Encodable for Amount

Source§

impl Encodable for BigSize

Source§

impl Encodable for BlockHash

Source§

impl Encodable for Bolt11Invoice

Source§

impl Encodable for Certificate

Source§

impl Encodable for Ciphertext

Source§

impl Encodable for DecryptionShare

Source§

impl Encodable for G1Affine

Source§

impl Encodable for G2Affine

Source§

impl Encodable for Hash

Source§

impl Encodable for Header

Source§

impl Encodable for Keypair

Source§

impl Encodable for Network

Source§

impl Encodable for OutPoint

Source§

impl Encodable for PartialMerkleTree

Source§

impl Encodable for Psbt

Source§

impl Encodable for PublicKey

Source§

impl Encodable for PublicKey

Source§

impl Encodable for PublicKeySet

Source§

impl Encodable for RoutingFees

Source§

impl Encodable for Scalar

Source§

impl Encodable for ScriptBuf

Source§

impl Encodable for SecretKey

Source§

impl Encodable for Signature

Source§

impl Encodable for Signature

Source§

impl Encodable for Transaction

Source§

impl Encodable for TxOut

Source§

impl Encodable for Txid

Source§

impl<K> Encodable for BTreeSet<K>
where K: Encodable,

Source§

impl<K> Encodable for Descriptor<K>
where K: MiniscriptKey,

Source§

impl<K, V> Encodable for BTreeMap<K, V>
where K: Encodable, V: Encodable,

Source§

impl<T1: Encodable, T2: Encodable> Encodable for (T1, T2)

Source§

impl<T1: Encodable, T2: Encodable, T3: Encodable> Encodable for (T1, T2, T3)

Source§

impl<T1: Encodable, T2: Encodable, T3: Encodable, T4: Encodable> Encodable for (T1, T2, T3, T4)

Source§

impl<T> Encodable for &[T]
where T: Encodable + 'static,

Source§

fn consensus_encode<W: Write>(&self, writer: &mut W) -> Result<usize>

Source§

impl<T> Encodable for Option<T>
where T: Encodable,

Source§

impl<T> Encodable for &T
where T: Encodable,

Source§

impl<T> Encodable for Box<T>
where T: Encodable,

Source§

impl<T> Encodable for VecDeque<T>
where T: Encodable + 'static,

Source§

fn consensus_encode<W: Write>(&self, writer: &mut W) -> Result<usize>

Source§

impl<T> Encodable for Vec<T>
where T: Encodable + 'static,

Source§

fn consensus_encode<W: Write>(&self, writer: &mut W) -> Result<usize>

Source§

impl<T> Encodable for RangeInclusive<T>
where T: Encodable,

Source§

impl<T, E> Encodable for Result<T, E>
where T: Encodable, E: Encodable,

Source§

impl<T, const SIZE: usize> Encodable for [T; SIZE]
where T: Encodable + 'static,

Implementors§

Source§

impl Encodable for ConsensusItem

Source§

impl Encodable for InviteCodePart

Source§

impl Encodable for SessionStatus

Source§

impl Encodable for TransactionError

Source§

impl Encodable for TransactionSignature

Source§

impl Encodable for fedimint_core::amount::Amount

Source§

impl Encodable for ClientBackupKey

Source§

impl Encodable for ClientBackupKeyPrefix

Source§

impl Encodable for ClientBackupSnapshot

Source§

impl Encodable for ClientConfig

Source§

impl Encodable for ClientConfigV0

Source§

impl Encodable for ClientModuleConfig

Source§

impl Encodable for FederationId

Source§

impl Encodable for FederationIdPrefix

Source§

impl Encodable for GlobalClientConfig

Source§

impl Encodable for GlobalClientConfigV0

Source§

impl Encodable for PeerUrl

Source§

impl Encodable for ServerModuleConsensusConfig

Source§

impl Encodable for BackupRequest

Source§

impl Encodable for DynClientConfig

Source§

impl Encodable for DynInput

Source§

impl Encodable for DynInputError

Source§

impl Encodable for DynModuleConsensusItem

Source§

impl Encodable for DynOutput

Source§

impl Encodable for DynOutputError

Source§

impl Encodable for DynOutputOutcome

Source§

impl Encodable for DynUnknown

Source§

impl Encodable for ModuleKind

Source§

impl Encodable for OperationId

Source§

impl Encodable for DatabaseVersion

Source§

impl Encodable for DatabaseVersionKey

Source§

impl Encodable for DatabaseVersionKeyV0

Source§

impl Encodable for AltDbPrefixTestPrefix

Source§

impl Encodable for AltTestKey

Source§

impl Encodable for DbPrefixTestPrefix

Source§

impl Encodable for DbPrefixTestPrefixV0

Source§

impl Encodable for PercentPrefixTestPrefix

Source§

impl Encodable for PercentTestKey

Source§

impl Encodable for TestKey

Source§

impl Encodable for TestKeyV0

Source§

impl Encodable for TestVal

Source§

impl Encodable for BitcoinRpcConfig

Source§

impl Encodable for InviteCode

Source§

impl Encodable for InviteCodeV2

Source§

impl Encodable for ApiVersion

Source§

impl Encodable for CoreConsensusVersion

Source§

impl Encodable for ModuleConsensusVersion

Source§

impl Encodable for MultiApiVersion

Source§

impl Encodable for SupportedApiVersionsSummary

Source§

impl Encodable for SupportedCoreApiVersions

Source§

impl Encodable for SupportedModuleApiVersions

Source§

impl Encodable for ApiAnnouncement

Source§

impl Encodable for SignedApiAnnouncement

Source§

impl Encodable for SignedApiAnnouncementSubmission

Source§

impl Encodable for PeerId

Source§

impl Encodable for AcceptedItem

Source§

impl Encodable for SchnorrSignature

Source§

impl Encodable for SessionOutcome

Source§

impl Encodable for SignedSessionOutcome

Source§

impl Encodable for Feerate

Source§

impl Encodable for fedimint_core::OutPoint

Source§

impl Encodable for fedimint_core::transaction::Transaction

Source§

impl Encodable for TransactionSubmissionOutcome

Source§

impl Encodable for TransactionId

Source§

impl Encodable for TxOutProof

Source§

impl Encodable for SafeUrl

Source§

impl Encodable for NetworkLegacyEncodingWrapper

Source§

impl Encodable for dyn DynEncodable

Source§

impl<C> Encodable for Tiered<C>
where C: Encodable,

Source§

impl<C> Encodable for TieredMulti<C>
where C: Encodable + 'static,

Source§

impl<T> Encodable for DynRawFallback<T>
where T: Encodable,