Struct avalanche_types::ids::bag::Bag
source · pub struct Bag { /* private fields */ }
Expand description
Represents a bag of multiple Ids for binary voting. ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/ids#Bag
Implementations§
source§impl Bag
impl Bag
pub fn new() -> Self
pub fn deep_copy(&self) -> Self
pub fn is_empty(&self) -> bool
pub fn len(&self) -> u32
pub fn mode(&self) -> Id
pub fn mode_frequency(&self) -> u32
pub fn threshold(&self) -> u32
sourcepub fn met_threshold(&self) -> HashSet<Id>
pub fn met_threshold(&self) -> HashSet<Id>
Returns the Ids that have been seen at least threshold times.
pub fn list(&self) -> Vec<Id> ⓘ
pub fn counts(&self) -> HashMap<Id, u32>
pub fn set_threshold(&self, threshold: u32)
pub fn add_count(&self, id: &Id, count: u32)
pub fn count(&self, id: &Id) -> u32
pub fn equals(&self, other: &Self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Bag
impl !Send for Bag
impl !Sync for Bag
impl Unpin for Bag
impl !UnwindSafe for Bag
Blanket Implementations§
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request