#[repr(C)]pub struct ValidatorList {
pub header: ValidatorListHeader,
pub validators: Vec<ValidatorStakeInfo>,
}Expand description
Storage list for all validator stake accounts in the pool.
Fields§
§header: ValidatorListHeaderData outside of the validator list, separated out for cheaper deserialization
validators: Vec<ValidatorStakeInfo>List of stake info for each validator in the pool
Implementations§
Source§impl ValidatorList
impl ValidatorList
Sourcepub fn new(max_validators: u32) -> Self
pub fn new(max_validators: u32) -> Self
Create an empty instance containing space for max_validators and
preferred validator keys
Sourcepub fn calculate_max_validators(buffer_length: usize) -> usize
pub fn calculate_max_validators(buffer_length: usize) -> usize
Calculate the number of validator entries that fit in the provided length
Sourcepub fn contains(&self, vote_account_address: &Pubkey) -> bool
pub fn contains(&self, vote_account_address: &Pubkey) -> bool
Check if contains validator with particular pubkey
Sourcepub fn find_mut(
&mut self,
vote_account_address: &Pubkey,
) -> Option<&mut ValidatorStakeInfo>
pub fn find_mut( &mut self, vote_account_address: &Pubkey, ) -> Option<&mut ValidatorStakeInfo>
Check if contains validator with particular pubkey
Sourcepub fn find(&self, vote_account_address: &Pubkey) -> Option<&ValidatorStakeInfo>
pub fn find(&self, vote_account_address: &Pubkey) -> Option<&ValidatorStakeInfo>
Check if contains validator with particular pubkey
Sourcepub fn has_active_stake(&self) -> bool
pub fn has_active_stake(&self) -> bool
Check if the list has any active stake
Trait Implementations§
Source§impl BorshDeserialize for ValidatorList
impl BorshDeserialize for ValidatorList
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSchema for ValidatorList
impl BorshSchema for ValidatorList
Source§fn declaration() -> Declaration
fn declaration() -> Declaration
Get the name of the type without brackets.
Source§fn add_definitions_recursively(
definitions: &mut BTreeMap<Declaration, Definition>,
)
fn add_definitions_recursively( definitions: &mut BTreeMap<Declaration, Definition>, )
Recursively, using DFS, add type definitions required for this type.
Type definition partially explains how to serialize/deserialize a type.
Source§impl BorshSerialize for ValidatorList
impl BorshSerialize for ValidatorList
Source§impl Clone for ValidatorList
impl Clone for ValidatorList
Source§fn clone(&self) -> ValidatorList
fn clone(&self) -> ValidatorList
Returns a duplicate of the value. Read more
1.0.0 · 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 ValidatorList
impl Debug for ValidatorList
Source§impl Default for ValidatorList
impl Default for ValidatorList
Source§fn default() -> ValidatorList
fn default() -> ValidatorList
Returns the “default value” for a type. Read more
Source§impl PartialEq for ValidatorList
impl PartialEq for ValidatorList
impl StructuralPartialEq for ValidatorList
Auto Trait Implementations§
impl Freeze for ValidatorList
impl RefUnwindSafe for ValidatorList
impl Send for ValidatorList
impl Sync for ValidatorList
impl Unpin for ValidatorList
impl UnwindSafe for ValidatorList
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 more