Expand description
Elections that arbitrate a setting across multiple voters.
Each voter casts or withdraws its vote in its own K slot of an Election, which elects the
winning value (the result):
- If an
override_voterhas an active vote, its vote wins. - Otherwise, active votes are combined using
cmp(Election::min,Election::max, or a custom comparator passed toElection::new).
Election holds its internal lock only for short map reads and writes, never across .await
points. Callers that need to update several Elections and apply the results as a single
transaction must serialize those updates themselves.
Structs§
- Election
- An election for one setting: tracks per-voter (
K) votes for a value of typeVand elects the winning value (the result).
Traits§
- Inspect
Value - Records a vote or result onto an Inspect
fuchsia_inspect::Nodeunderkey.