[−][src]Struct tinyset::tinyset::TinySet
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(&self) -> 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?
ⓘImportant traits for Iter<'a, T>fn into_iter(self) -> Iter<'a, T>
[src]
impl<T: Debug + HasInvalid> Debug for TinySet<T>
[src]
impl<T: HasInvalid> FromIterator<T> for TinySet<T>
[src]
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
[src]
Auto Trait Implementations
Blanket Implementations
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<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,