Struct OrderedSet

Source
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>
where V: Hash + Eq,

Source

pub fn new() -> Self

Source

pub fn with_capacity(capacity: usize) -> Self

Source

pub fn size(&self) -> usize

Return the number of key-value pairs in the map.

Computes in O(1) time.

Source

pub fn is_empty(&self) -> bool

Returns true if the map contains no elements.

Computes in O(1) time.

Source

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).

Source

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).

Source

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).

Source

pub fn get_index(&self, index: usize) -> Option<&V>

Get a key-value pair by index Valid indices are 0 <= index < self.len() Computes in O(1) time.

Source

pub fn iter(&self) -> Iter<'_, V>

Return an iterator over the values of the set, in their order

Trait Implementations§

Source§

impl<V, S: Clone> Clone for OrderedSet<V, S>
where V: Hash + Eq + Clone,

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl<V: Hash + Eq + Debug> Debug for OrderedSet<V>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<V: Hash + Eq> Default for OrderedSet<V>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<V: Eq + Hash + Trace, S: BuildHasher> Finalize for OrderedSet<V, S>

Source§

impl<'a, V, S> IntoIterator for &'a OrderedSet<V, S>
where V: Hash + Eq, S: BuildHasher,

Source§

type Item = &'a V

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, V>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<V, S> IntoIterator for OrderedSet<V, S>
where V: Hash + Eq, S: BuildHasher,

Source§

type Item = V

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<V>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> IntoIter<V>

Creates an iterator from a value. Read more
Source§

impl<V: Eq + Hash + Trace, S: BuildHasher> Trace for OrderedSet<V, S>

Source§

unsafe fn trace(&self)

Marks all contained Gcs.
Source§

unsafe fn root(&self)

Increments the root-count of all contained Gcs.
Source§

unsafe fn unroot(&self)

Decrements the root-count of all contained Gcs.
Source§

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>

§

impl<V, S> Send for OrderedSet<V, S>
where S: Send, V: Send,

§

impl<V, S> Sync for OrderedSet<V, S>
where S: Sync, V: Sync,

§

impl<V, S> Unpin for OrderedSet<V, S>
where S: Unpin, V: Unpin,

§

impl<V, S> UnwindSafe for OrderedSet<V, S>
where S: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> NativeObject for T
where T: Any + Debug + Trace,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert the Rust type which implements NativeObject to a &dyn Any.
Source§

fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)

Convert the Rust type which implements NativeObject to a &mut dyn Any.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V