pub struct OrderedSet<V, S = RandomState>(/* private fields */)
where
V: Hash + Eq;
Expand description
A newtype wrapping indexmap::IndexSet
Implementations§
Source§impl<V> OrderedSet<V>
impl<V> OrderedSet<V>
pub fn new() -> Self
pub fn with_capacity(capacity: usize) -> Self
Sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
Return the number of key-value pairs in the map.
Computes in O(1) time.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the map contains no elements.
Computes in O(1) time.
Sourcepub fn add(&mut self, value: V) -> bool
pub fn add(&mut self, value: V) -> bool
Insert a value pair in the set.
If an equivalent value already exists in the set: ???
If no equivalent value existed in the set: the new value is inserted, last in order, and false
Computes in O(1) time (amortized average).
Sourcepub fn delete(&mut self, value: &V) -> bool
pub fn delete(&mut self, value: &V) -> bool
Delete the value
from the set and return true if successful
Return false
if value
is not in map.
Computes in O(n) time (average).
Sourcepub fn contains(&self, value: &V) -> bool
pub fn contains(&self, value: &V) -> bool
Checks if a given value is present in the set
Return true
if value
is present in set, false otherwise.
Computes in O(n) time (average).
Trait Implementations§
Source§impl<V, S: Clone> Clone for OrderedSet<V, S>
impl<V, S: Clone> Clone for OrderedSet<V, S>
Source§fn clone(&self) -> OrderedSet<V, S>
fn clone(&self) -> OrderedSet<V, S>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<V: Eq + Hash + Trace, S: BuildHasher> Finalize for OrderedSet<V, S>
impl<V: Eq + Hash + Trace, S: BuildHasher> Finalize for OrderedSet<V, S>
Source§impl<'a, V, S> IntoIterator for &'a OrderedSet<V, S>
impl<'a, V, S> IntoIterator for &'a OrderedSet<V, S>
Source§impl<V, S> IntoIterator for OrderedSet<V, S>
impl<V, S> IntoIterator for OrderedSet<V, S>
Source§impl<V: Eq + Hash + Trace, S: BuildHasher> Trace for OrderedSet<V, S>
impl<V: Eq + Hash + Trace, S: BuildHasher> Trace for OrderedSet<V, S>
Source§fn finalize_glue(&self)
fn finalize_glue(&self)
Runs Finalize::finalize() on this object and all
contained subobjects
Auto Trait Implementations§
impl<V, S> Freeze for OrderedSet<V, S>where
S: Freeze,
impl<V, S> RefUnwindSafe for OrderedSet<V, S>where
S: RefUnwindSafe,
V: RefUnwindSafe,
impl<V, S> Send for OrderedSet<V, S>
impl<V, S> Sync for OrderedSet<V, S>
impl<V, S> Unpin for OrderedSet<V, S>
impl<V, S> UnwindSafe for OrderedSet<V, S>where
S: UnwindSafe,
V: 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