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