[][src]Struct tari_utilities::fixed_set::FixedSet

pub struct FixedSet<T> { /* fields omitted */ }

Implementations

impl<T: Clone + PartialEq + Default> FixedSet<T>[src]

pub fn new(n: usize) -> FixedSet<T>[src]

Creates a new fixed set of size n.

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

Returns the size of the fixed set, NOT the number of items that have been set

pub fn set_item(&mut self, index: usize, val: T) -> bool[src]

Set the indexth item to val. Any existing item is overwritten. The set takes ownership of val.

pub fn get_item(&self, index: usize) -> Option<&T>[src]

Return a reference to the indexth item, or None if that item has not been set yet.

pub fn clear_item(&mut self, index: usize)[src]

Delete an item from the set by setting the indexth value to None

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

Returns true if every item in the set has been set. An empty set returns true as well.

pub fn search(&self, val: &T) -> Option<usize>[src]

Return the index of the given item in the set by performing a linear search through the set

pub fn sum(&self) -> Option<T> where
    &'a T: Add<&'a T, Output = T>, 
[src]

Produces the sum of the values in the set, provided the set is full

pub fn into_vec(self) -> Vec<T>[src]

Collects all non-empty elements of the set into a Vec instance

Trait Implementations

impl<T: Clone> Clone for FixedSet<T>[src]

impl<T: Debug> Debug for FixedSet<T>[src]

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.

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.

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