pub struct ValidatorSet { /* private fields */ }Expand description
The ordered, weighted validator set for one epoch.
Implementations§
Source§impl ValidatorSet
impl ValidatorSet
pub fn new(validators: Vec<Validator>) -> Self
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn total_power(&self) -> u64
pub fn get(&self, id: &ValidatorId) -> Option<&Validator>
pub fn contains(&self, id: &ValidatorId) -> bool
pub fn voting_power_of(&self, id: &ValidatorId) -> u64
Sourcepub fn proposer(&self, height: u64, round: u32) -> Option<&Validator>
pub fn proposer(&self, height: u64, round: u32) -> Option<&Validator>
Deterministic leader for (height, round): weighted round-robin.
pub fn iter(&self) -> impl Iterator<Item = &Validator>
Trait Implementations§
Source§impl Clone for ValidatorSet
impl Clone for ValidatorSet
Source§fn clone(&self) -> ValidatorSet
fn clone(&self) -> ValidatorSet
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ValidatorSet
impl Debug for ValidatorSet
Source§impl Default for ValidatorSet
impl Default for ValidatorSet
Source§fn default() -> ValidatorSet
fn default() -> ValidatorSet
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ValidatorSet
impl<'de> Deserialize<'de> for ValidatorSet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ValidatorSet
impl RefUnwindSafe for ValidatorSet
impl Send for ValidatorSet
impl Sync for ValidatorSet
impl Unpin for ValidatorSet
impl UnsafeUnpin for ValidatorSet
impl UnwindSafe for ValidatorSet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more