[][src]Struct stonks::Set

pub struct Set<T> where
    T: Hash
{ /* fields omitted */ }

Implementations

impl<T> Set<T> where
    T: Hash + Eq
[src]

pub fn new() -> Self[src]

Create an empty Set. Uses a HashSet internally.

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

Returns the number of elements in the set.

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

Returns a reference to the value in the set, if any, that is equal to the given value.

pub fn insert(&self, value: 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 get_or_insert(&self, value: T) -> &T where
    T: Clone
[src]

Inserts the given value into the set if it is not present, then returns a reference to the value in the set. Currently, this implementation uses requires T: Clone, because the feature hash_set_entry isn't stabilized yet.

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

Returns true if the set contains a value.

Auto Trait Implementations

impl<T> !RefUnwindSafe for Set<T>

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

impl<T> !Sync for Set<T>

impl<T> Unpin for Set<T>

impl<T> UnwindSafe for Set<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, 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.