pub struct Set<T>where
T: Hash,{ /* private fields */ }Implementations§
Source§impl<T> Set<T>
impl<T> Set<T>
Sourcepub fn get(&self, value: &T) -> Option<&T>
pub fn get(&self, value: &T) -> Option<&T>
Returns a reference to the value in the set, if any, that is equal to the given value.
Sourcepub fn insert(&self, value: T) -> bool
pub fn insert(&self, value: T) -> bool
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.
Sourcepub fn get_or_insert(&self, value: T) -> &Twhere
T: Clone,
pub fn get_or_insert(&self, value: T) -> &Twhere
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.
Auto Trait Implementations§
impl<T> !Freeze for Set<T>
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more