Trait DigestModel

Source
pub trait DigestModel<Proprietor>: Commitment<Proprietor> {
    type Model: Delimited + RuntimeEnum + Storable;

    // Required method
    fn determine_digest(
        digest: &Self::Digest,
        reason: &Self::Reason,
    ) -> Result<Self::Model, DispatchError>;
}
Expand description

A trait for determining the model variant of a digest.

In this system, a “digest” represents a compact identifier for a commitment or resource.

Since all digests share a common base type, this trait provides a way to classify or wrap them into distinct model variants (e.g., Direct, Index, Pools) to improve clarity and enforce type safety.

Required Associated Types§

Source

type Model: Delimited + RuntimeEnum + Storable

Wraps Commitment::Digest to reduce ambiguity.

Required Methods§

Source

fn determine_digest( digest: &Self::Digest, reason: &Self::Reason, ) -> Result<Self::Model, DispatchError>

Determines the appropriate model variant for the given digest and reason.

§Returns
  • Ok(Model) if the digest is recognized.
  • Err(DispatchError) if the digest cannot be determined.

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.

Implementors§