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§
Sourcefn score(who: &AccountId) -> Option<Self::Score>
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§
Sourcefn set_score_of(_: &AccountId, _: Self::Score)
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.