[][src]Struct tinyset::tinyset::TinySet

pub struct TinySet<T: HasInvalid> { /* fields omitted */ }

A set implemented for types that have an invalid value and can be quickly hashed to a u32.

This set stores two elements without heap allocation, and otherwise will store the set using a Robin Hood hash table, but with the hashes not being stored to save space.

Methods

impl<T: HasInvalid> TinySet<T>[src]

pub fn default() -> TinySet<T>[src]

Creates an empty set..

pub fn new() -> TinySet<T>[src]

Creates an empty set..

pub fn with_capacity(cap: usize) -> TinySet<T>[src]

Creates an empty set with the specified capacity.

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

Returns the number of elements in the set.

pub fn reserve(&mut self, additional: usize)[src]

Reserves capacity for at least additional more elements to be inserted in the set. The collection may reserve more space to avoid frequent reallocations.

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

Adds a value to the set.

If the set did not have this value present, true is returned.

If the set did have this value present, false is returned.

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

Returns true if the set contains a value.

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

Removes an element, and returns true if that element was present.

Important traits for Iter<'a, T>
pub fn iter(&self) -> Iter<T>[src]

Returns an iterator over the set.

Important traits for IntoIter<T>
pub fn drain(&mut self) -> IntoIter<T>[src]

Clears the set, returning all elements in an iterator.

Trait Implementations

impl<T: Clone + HasInvalid> Clone for TinySet<T>[src]

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

Performs copy-assignment from source. Read more

impl<'a, T: HasInvalid> IntoIterator for &'a TinySet<T>[src]

type Item = &'a T

The type of the elements being iterated over.

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?

impl<T: Debug + HasInvalid> Debug for TinySet<T>[src]

impl<T: HasInvalid> FromIterator<T> for TinySet<T>[src]

Auto Trait Implementations

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

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

Blanket Implementations

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

impl<T> From<T> for 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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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