Struct ds_ext::set::OrdHashSet  
source · pub struct OrdHashSet<T> { /* private fields */ }Expand description
A std::collections::HashSet ordered using a List.
Implementations§
source§impl<T> OrdHashSet<T>
 
impl<T> OrdHashSet<T>
sourcepub fn new() -> Self
 
pub fn new() -> Self
Construct a new OrdHashSet.
sourcepub fn with_capacity(capacity: usize) -> Self
 
pub fn with_capacity(capacity: usize) -> Self
Construct a new OrdHashSet with the given capacity.
sourcepub fn iter(&self) -> Iter<'_, T> ⓘ
 
pub fn iter(&self) -> Iter<'_, T> ⓘ
Construct an iterator over the items in this OrdHashSet.
sourcepub fn is_empty(&self) -> bool
 
pub fn is_empty(&self) -> bool
Return true if this OrdHashSet is empty.
sourcepub fn len(&self) -> usize
 
pub fn len(&self) -> usize
Return the number of items in this OrdHashSet.
source§impl<T: Eq + Hash + Ord> OrdHashSet<T>
 
impl<T: Eq + Hash + Ord> OrdHashSet<T>
sourcepub fn bisect<Cmp>(&self, cmp: Cmp) -> Option<&T>
 
pub fn bisect<Cmp>(&self, cmp: Cmp) -> Option<&T>
Bisect this set to match an item using the provided comparison, and return it (if present).
The first item for which the comparison returns Some(Ordering::Equal) will be returned.
This method assumes that any partially-ordered items (where cmp(item).is_none())
are ordered at the beginning or end of the set.
sourcepub fn bisect_and_remove<Cmp>(&mut self, cmp: Cmp) -> Option<T>
 
pub fn bisect_and_remove<Cmp>(&mut self, cmp: Cmp) -> Option<T>
Bisect this set to match and remove an item using the provided comparison.
The first item for which the comparison returns Some(Ordering::Equal) will be returned.
This method assumes that any partially-ordered items (where cmp(item).is_none())
are ordered at the beginning and/or end of the set.
sourcepub fn clear(&mut self)
 
pub fn clear(&mut self)
Remove all items from this OrdHashSet.
sourcepub fn contains<Q>(&self, item: &Q) -> bool
 
pub fn contains<Q>(&self, item: &Q) -> bool
Return true if the given item is present in this OrdHashSet.
sourcepub fn drain(&mut self) -> Drain<'_, T> ⓘ
 
pub fn drain(&mut self) -> Drain<'_, T> ⓘ
Drain all items from this OrdHashSet.
sourcepub fn drain_while<Cond>(&mut self, cond: Cond) -> DrainWhile<'_, T, Cond> ⓘ
 
pub fn drain_while<Cond>(&mut self, cond: Cond) -> DrainWhile<'_, T, Cond> ⓘ
Drain items from this OrdHashSet while they match the given condition.
sourcepub fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
 
pub fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Consume the given iter and insert all its items into this OrdHashSet
sourcepub fn first(&self) -> Option<&T>
 
pub fn first(&self) -> Option<&T>
Borrow the first item in this OrdHashSet.
sourcepub fn insert(&mut self, item: T) -> bool
 
pub fn insert(&mut self, item: T) -> bool
Insert an item into this OrdHashSet and return false if it was already present.
sourcepub fn last(&self) -> Option<&T>
 
pub fn last(&self) -> Option<&T>
Borrow the last item in this OrdHashSet.
sourcepub fn pop_first(&mut self) -> Option<T>where
    T: Debug,
 
pub fn pop_first(&mut self) -> Option<T>where
    T: Debug,
Remove and return the first item in this OrdHashSet.
sourcepub fn pop_last(&mut self) -> Option<T>where
    T: Debug,
 
pub fn pop_last(&mut self) -> Option<T>where
    T: Debug,
Remove and return the last item in this OrdHashSet.
sourcepub fn remove<Q>(&mut self, item: &Q) -> bool
 
pub fn remove<Q>(&mut self, item: &Q) -> bool
Remove the given item from this OrdHashSet and return true if it was present.
The item may be any borrowed form of T,
but the ordering on the borrowed form must match the ordering of T.
sourcepub fn starts_with<'a, I: IntoIterator<Item = &'a T>>(
    &'a self,
    other: I,
) -> boolwhere
    T: PartialEq,
 
pub fn starts_with<'a, I: IntoIterator<Item = &'a T>>(
    &'a self,
    other: I,
) -> boolwhere
    T: PartialEq,
Return true if the first elements in this set are equal to those in the given iter.
Trait Implementations§
source§impl<T: Eq + Hash + Ord + Debug> FromIterator<T> for OrdHashSet<T>
 
impl<T: Eq + Hash + Ord + Debug> FromIterator<T> for OrdHashSet<T>
source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
 
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
source§impl<T: GetSize> GetSize for OrdHashSet<T>
 
impl<T: GetSize> GetSize for OrdHashSet<T>
source§fn get_heap_size(&self) -> usize
 
fn get_heap_size(&self) -> usize
source§fn get_stack_size() -> usize
 
fn get_stack_size() -> usize
source§impl<'a, T> IntoIterator for &'a OrdHashSet<T>
 
impl<'a, T> IntoIterator for &'a OrdHashSet<T>
source§impl<T: Debug> IntoIterator for OrdHashSet<T>
 
impl<T: Debug> IntoIterator for OrdHashSet<T>
impl<T: Eq + Debug> Eq for OrdHashSet<T>
Auto Trait Implementations§
impl<T> Freeze for OrdHashSet<T>
impl<T> RefUnwindSafe for OrdHashSet<T>where
    T: RefUnwindSafe,
impl<T> Send for OrdHashSet<T>
impl<T> Sync for OrdHashSet<T>
impl<T> Unpin for OrdHashSet<T>
impl<T> UnwindSafe for OrdHashSet<T>where
    T: RefUnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
 
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)