Config

Trait Config 

Source
pub trait Config<S: Scheme>:
    Clone
    + Default
    + Send
    + 'static {
    type Elector: Elector<S>;

    // Required method
    fn build(self, participants: &Set<S::PublicKey>) -> Self::Elector;
}
Expand description

Configuration for creating an Elector.

Users create and configure this type, then pass it to the consensus configuration. Consensus will call build internally with the correct participant set to create the initialized Elector.

§Determinism Requirement

Implementations must be deterministic: given the same construction parameters and the same inputs to Elector::elect, the method must always return the same leader index. This is critical for consensus correctness - all honest participants must agree on the leader for each round.

Required Associated Types§

Source

type Elector: Elector<S>

The initialized elector type.

Required Methods§

Source

fn build(self, participants: &Set<S::PublicKey>) -> Self::Elector

Builds the elector with the given participants.

Called internally by consensus with the correct participant set.

§Panics

Implementations should panic if participants is empty.

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§

Source§

impl<P, V> Config<Scheme<P, V>> for Random
where P: PublicKey, V: Variant + Send + Sync + 'static,

Source§

impl<S: Scheme, H: Hasher> Config<S> for RoundRobin<H>