pub struct Set<T: Hash + Eq + 'static> { /* private fields */ }Implementations§
Source§impl<T: Eq + Hash + 'static> Set<T>
impl<T: Eq + Hash + 'static> Set<T>
pub fn try_new() -> Result<Self, SetError>
pub fn try_insert(&mut self, value: T) -> Result<SetId<T>, SetError>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn capacity(&self) -> usize
Sourcepub fn find(&self, value: &T) -> Option<SetId<T>>
pub fn find(&self, value: &T) -> Option<SetId<T>>
Returns the SetId for value if it exists in the set, without inserting.
This is primarily intended for tests and debugging. In typical usage
you should prefer try_insert which handles both existence checks and
insertion atomically in the intended access pattern.
Sourcepub unsafe fn get(&self, id: SetId<T>) -> &T
pub unsafe fn get(&self, id: SetId<T>) -> &T
Returns a shared reference to the value for a given SetId.
§Safety
- The
idmust have been obtained from this exactSet<T>instance (or remain valid for it). Using an id from another set, or after the backing arena is torn down, is undefined behavior.
§Safety
idmust have been obtained from this exactSet<T>instance and still refer to a live element in its arena.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Set<T>
impl<T> !RefUnwindSafe for Set<T>
impl<T> !Send for Set<T>
impl<T> !Sync for Set<T>
impl<T> Unpin for Set<T>
impl<T> !UnwindSafe for Set<T>
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