pub trait PoolVariant<Proprietor>:
CommitVariant<Proprietor>
+ CommitPool<Proprietor>
+ CommitIndex<Proprietor> {
// Required methods
fn get_slot_variant(
reason: &Self::Reason,
pool_of: &Self::Digest,
slot_of: &Self::Digest,
) -> Result<Self::Position, DispatchError>;
fn set_slot_of_variant(
who: &Proprietor,
reason: &Self::Reason,
pool_of: &Self::Digest,
slot_of: &Self::Digest,
variant: Self::Position,
shares: Option<Self::Shares>,
) -> DispatchResult;
// Provided method
fn on_set_slot_of_variant(
_pool_of: &Self::Digest,
_reason: &Self::Reason,
_slot_of: &Self::Digest,
_shares: Option<Self::Shares>,
_variant: &Self::Position,
) { ... }
}Expand description
A trait for managing and querying variants of pool slots and their commitments.
Extends CommitPool to allow pool commitments to carry additional positional
or variant metadata.
Provides the ability to retrieve, set, and react to variant changes within a pool context.
Generics:
- Proprietor - the entity that owns the asset and can make commitments.
Required Methods§
Sourcefn get_slot_variant(
reason: &Self::Reason,
pool_of: &Self::Digest,
slot_of: &Self::Digest,
) -> Result<Self::Position, DispatchError>
fn get_slot_variant( reason: &Self::Reason, pool_of: &Self::Digest, slot_of: &Self::Digest, ) -> Result<Self::Position, DispatchError>
Retrieves the variant (position) associated with a specific slot within a pool.
Returns the position classification for the given slot digest under the specified reason and pool digest. This enables querying the directional or positional semantics of individual slots within a managed variant-aware pool.
§Returns
Ok(Position)containing the slot’s variantErr(DispatchError)if the pool or slot does not exist
Sourcefn set_slot_of_variant(
who: &Proprietor,
reason: &Self::Reason,
pool_of: &Self::Digest,
slot_of: &Self::Digest,
variant: Self::Position,
shares: Option<Self::Shares>,
) -> DispatchResult
fn set_slot_of_variant( who: &Proprietor, reason: &Self::Reason, pool_of: &Self::Digest, slot_of: &Self::Digest, variant: Self::Position, shares: Option<Self::Shares>, ) -> DispatchResult
Associates or updates a variant for a specific slot within a pool.
Records a position (variant) for a slot digest within the context of a given pool digest and reason. If shares are provided, they are updated alongside the variant.
Since pools are mutable (unlike indexes), this method directly updates the slot’s variant without creating a new pool digest.
This is a managed operation - typically restricted to the pool manager or authorized entities, ensuring controlled strategy execution while protecting depositor interests.
§Returns
Ok(())if the variant is successfully updatedErr(DispatchError)if fails
Provided Methods§
Sourcefn on_set_slot_of_variant(
_pool_of: &Self::Digest,
_reason: &Self::Reason,
_slot_of: &Self::Digest,
_shares: Option<Self::Shares>,
_variant: &Self::Position,
)
fn on_set_slot_of_variant( _pool_of: &Self::Digest, _reason: &Self::Reason, _slot_of: &Self::Digest, _shares: Option<Self::Shares>, _variant: &Self::Position, )
Hook called after a slot variant is updated within a pool.
Provides an extension point for triggering side-effects when a slot’s variant is associated or changed within a managed pool.
Receives both the slot digest and optional shares to enable comprehensive state management and analytics when managed slot configurations change.
Default implementation is a no-op.
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.