Struct qmc::util::bondcontainer::BondContainer[][src]

pub struct BondContainer<T: Clone + Into<usize>> { /* fields omitted */ }
Expand description

A HashSet with random sampling.

Implementations

impl<T: Clone + Into<usize>> BondContainer<T>[src]

pub fn get_total_weight(&self) -> f64[src]

Return sum of all weights in BondContainer.

pub fn get_random<R: Rng>(&self, r: R) -> Option<&(T, f64)>[src]

Get a random weighted entry.

pub fn remove(&mut self, value: &T) -> bool[src]

Remove a given value.

pub fn contains(&self, value: &T) -> bool[src]

Check if a given element has been inserted.

pub fn get_weight(&self, value: &T) -> Option<f64>[src]

Get the weight of the value if it’s in the container.

pub fn insert(&mut self, value: T, weight: f64) -> bool[src]

Insert an element. Returns true if the element is new.

pub fn clear(&mut self)[src]

Clear the set

pub fn len(&self) -> usize[src]

Get number of elements in set.

pub fn is_empty(&self) -> bool[src]

Check if empty.

pub fn iter(&self) -> impl Iterator<Item = &(T, f64)>[src]

Iterate through items.

Trait Implementations

impl<T: Clone + Into<usize>> Clone for BondContainer<T>[src]

fn clone(&self) -> BondContainer<T>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: Debug + Clone + Into<usize>> Debug for BondContainer<T>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<T: Default + Clone + Into<usize>> Default for BondContainer<T>[src]

fn default() -> BondContainer<T>[src]

Returns the “default value” for a type. Read more

impl<O: Op + Clone, ALLOC: FastOpAllocator> Factory<BondContainer<VarPos>> for FastOpsTemplate<O, ALLOC>[src]

fn get_instance(&mut self) -> BondContainer<VarPos>[src]

Get an instance of T

fn return_instance(&mut self, t: BondContainer<VarPos>)[src]

Return an instance of T

impl Factory<BondContainer<VarPos>> for DefaultFastOpAllocator[src]

fn get_instance(&mut self) -> BondContainer<VarPos>[src]

Get an instance of T

fn return_instance(&mut self, t: BondContainer<VarPos>)[src]

Return an instance of T

impl<ALLOC: FastOpAllocator> Factory<BondContainer<VarPos>> for SwitchableFastOpAllocator<ALLOC>[src]

fn get_instance(&mut self) -> BondContainer<VarPos>[src]

Get an instance of T

fn return_instance(&mut self, t: BondContainer<VarPos>)[src]

Return an instance of T

impl<O: Op + Clone, ALLOC: FastOpAllocator> Factory<BondContainer<usize>> for FastOpsTemplate<O, ALLOC>[src]

fn get_instance(&mut self) -> BondContainer<usize>[src]

Get an instance of T

fn return_instance(&mut self, t: BondContainer<usize>)[src]

Return an instance of T

impl Factory<BondContainer<usize>> for DefaultFastOpAllocator[src]

fn get_instance(&mut self) -> BondContainer<usize>[src]

Get an instance of T

fn return_instance(&mut self, t: BondContainer<usize>)[src]

Return an instance of T

impl<ALLOC: FastOpAllocator> Factory<BondContainer<usize>> for SwitchableFastOpAllocator<ALLOC>[src]

fn get_instance(&mut self) -> BondContainer<usize>[src]

Get an instance of T

fn return_instance(&mut self, t: BondContainer<usize>)[src]

Return an instance of T

impl<T: Clone + Into<usize>> Reset for BondContainer<T>[src]

fn reset(&mut self)[src]

Reset the instance, keep the util location.

Auto Trait Implementations

impl<T> RefUnwindSafe for BondContainer<T> where
    T: RefUnwindSafe

impl<T> Send for BondContainer<T> where
    T: Send

impl<T> Sync for BondContainer<T> where
    T: Sync

impl<T> Unpin for BondContainer<T> where
    T: Unpin

impl<T> UnwindSafe for BondContainer<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V