pub struct DynamicWeightedSampler { /* private fields */ }Implementations§
Source§impl DynamicWeightedSampler
impl DynamicWeightedSampler
pub fn new(max_value: f64) -> Self
pub fn new_with_capacity(max_value: f64, physical_capacity: usize) -> Self
pub fn insert(&mut self, id: usize, weight: f64)
pub fn remove(&mut self, id: usize) -> f64
pub fn update(&mut self, id: usize, new_weight: f64)
pub fn update_delta(&mut self, id: usize, delta: f64)
pub fn get_weight(&self, id: usize) -> f64
pub fn get_total_weight(&self) -> f64
pub fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Option<usize>
pub fn check_invariant(&self) -> bool
Trait Implementations§
Source§impl Clone for DynamicWeightedSampler
impl Clone for DynamicWeightedSampler
Source§fn clone(&self) -> DynamicWeightedSampler
fn clone(&self) -> DynamicWeightedSampler
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 moreAuto Trait Implementations§
impl Freeze for DynamicWeightedSampler
impl RefUnwindSafe for DynamicWeightedSampler
impl Send for DynamicWeightedSampler
impl Sync for DynamicWeightedSampler
impl Unpin for DynamicWeightedSampler
impl UnwindSafe for DynamicWeightedSampler
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