referrerpolicy=no-referrer-when-downgrade
frame_election_provider_support

Trait ScoreProvider

Source
pub trait ScoreProvider<AccountId> {
    type Score;

    // Required method
    fn score(who: &AccountId) -> Option<Self::Score>;

    // Provided method
    fn set_score_of(_: &AccountId, _: Self::Score) { ... }
}
Expand description

Something that can provide the Score of an account. Similar to ElectionProvider and ElectionDataProvider, this should typically be implementing by whoever is supposed to use SortedListProvider.

Required Associated Types§

Required Methods§

Source

fn score(who: &AccountId) -> Option<Self::Score>

Get the current Score of who, None if who is not present.

None can be interpreted as a signal that the voter should be removed from the list.

Provided Methods§

Source

fn set_score_of(_: &AccountId, _: Self::Score)

For tests, benchmarks and fuzzing, set the score.

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§

impl ScoreProvider<<Runtime as Config>::AccountId> for StakingMock

impl<T: Config<I>, I: 'static> ScoreProvider<<T as Config>::AccountId> for Pallet<T, I>

impl<T: Config> ScoreProvider<<T as Config>::AccountId> for Pallet<T>

impl<T: Config> ScoreProvider<<T as Config>::AccountId> for Pallet<T>