pub struct Validators<VID>{ /* private fields */ }
Expand description
The validator IDs and weight map.
Implementations§
Source§impl<VID: Eq + Hash> Validators<VID>
impl<VID: Eq + Hash> Validators<VID>
Sourcepub fn total_weight(&self) -> Weight
pub fn total_weight(&self) -> Weight
Returns the total weight of the set of validators.
Sourcepub fn weight(&self, idx: ValidatorIndex) -> Weight
pub fn weight(&self, idx: ValidatorIndex) -> Weight
Returns the weight of the validator with the given index.
Panics if the validator index does not exist.
Sourcepub fn get_index(&self, id: &VID) -> Option<ValidatorIndex>
pub fn get_index(&self, id: &VID) -> Option<ValidatorIndex>
Gets the index of a validator with the given ID. Returns None
if no such validator is in
the set.
Sourcepub fn id(&self, idx: ValidatorIndex) -> Option<&VID>
pub fn id(&self, idx: ValidatorIndex) -> Option<&VID>
Returns validator ID by index, or None
if it doesn’t exist.
Sourcepub fn iter(&self) -> impl Iterator<Item = &Validator<VID>>
pub fn iter(&self) -> impl Iterator<Item = &Validator<VID>>
Returns an iterator over all validators, sorted by ID.
Sourcepub fn ban(&mut self, vid: &VID)
pub fn ban(&mut self, vid: &VID)
Marks the validator with that ID as banned, if it exists, and excludes it from the leader sequence.
Sourcepub fn set_cannot_propose(&mut self, vid: &VID)
pub fn set_cannot_propose(&mut self, vid: &VID)
Marks the validator as excluded from the leader sequence.
Sourcepub fn iter_banned_idx(&self) -> impl Iterator<Item = ValidatorIndex> + '_
pub fn iter_banned_idx(&self) -> impl Iterator<Item = ValidatorIndex> + '_
Returns an iterator of all indices of banned validators.
Sourcepub fn iter_cannot_propose_idx(
&self,
) -> impl Iterator<Item = ValidatorIndex> + '_
pub fn iter_cannot_propose_idx( &self, ) -> impl Iterator<Item = ValidatorIndex> + '_
Returns an iterator of all indices of validators that are not allowed to propose values.
Sourcepub fn enumerate_ids<'a>(
&'a self,
) -> impl Iterator<Item = (ValidatorIndex, &'a VID)>
pub fn enumerate_ids<'a>( &'a self, ) -> impl Iterator<Item = (ValidatorIndex, &'a VID)>
Returns an iterator of pairs (validator index, validator ID).
Trait Implementations§
Source§impl<VID> Clone for Validators<VID>
impl<VID> Clone for Validators<VID>
Source§fn clone(&self) -> Validators<VID>
fn clone(&self) -> Validators<VID>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<VID> DataSize for Validators<VID>
impl<VID> DataSize for Validators<VID>
Source§const IS_DYNAMIC: bool
const IS_DYNAMIC: bool
true
, the type has a heap size that can vary at runtime, depending on the actual value.Source§const STATIC_HEAP_SIZE: usize
const STATIC_HEAP_SIZE: usize
IS_DYNAMIC
is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.Source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
Source§fn estimate_detailed_heap_size(&self) -> MemUsageNode
fn estimate_detailed_heap_size(&self) -> MemUsageNode
Source§impl<VID> Debug for Validators<VID>
impl<VID> Debug for Validators<VID>
Source§impl<VID: Ord + Hash + Clone, W: Into<Weight>> FromIterator<(VID, W)> for Validators<VID>
impl<VID: Ord + Hash + Clone, W: Into<Weight>> FromIterator<(VID, W)> for Validators<VID>
Source§fn from_iter<I: IntoIterator<Item = (VID, W)>>(ii: I) -> Validators<VID>
fn from_iter<I: IntoIterator<Item = (VID, W)>>(ii: I) -> Validators<VID>
Auto Trait Implementations§
impl<VID> Freeze for Validators<VID>
impl<VID> RefUnwindSafe for Validators<VID>where
VID: RefUnwindSafe,
impl<VID> Send for Validators<VID>where
VID: Send,
impl<VID> Sync for Validators<VID>where
VID: Sync,
impl<VID> Unpin for Validators<VID>where
VID: Unpin,
impl<VID> UnwindSafe for Validators<VID>where
VID: UnwindSafe,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<From, To> FallibleInto<To> for Fromwhere
To: TryFrom<From>,
impl<From, To> FallibleInto<To> for Fromwhere
To: TryFrom<From>,
fn try_into_wrapped(self) -> Result<To, VMError>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out
indicating that a T
is niched.