[−][src]Struct tari_utilities::fixed_set::FixedSet
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 index
th 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 index
th 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 index
th 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]
&'a T: Add<&'a T, Output = T>,
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
Auto Trait Implementations
impl<T> RefUnwindSafe for FixedSet<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for FixedSet<T> where
T: Send,
T: Send,
impl<T> Sync for FixedSet<T> where
T: Sync,
T: Sync,
impl<T> Unpin for FixedSet<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for FixedSet<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,