[−][src]Struct stonks::Set
Implementations
impl<T> Set<T> where
T: Hash + Eq,
[src]
T: Hash + Eq,
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]
T: Clone,
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,
T: Send,
impl<T> !Sync for Set<T>
impl<T> Unpin for Set<T>
impl<T> UnwindSafe for Set<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, 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>,