Skip to main content

OrderedSet

Struct OrderedSet 

Source
pub struct OrderedSet<K, E> { /* private fields */ }
Expand description

Mutable insertion-ordered set with caller-defined key equivalence.

Implementations§

Source§

impl<K, E> OrderedSet<K, E>
where E: KeyEquivalence<K>,

Source

pub fn new(equivalence: E) -> Self

Construct an empty set using equivalence for membership.

Source

pub fn len(&self) -> usize

Return the number of members.

Source

pub fn is_empty(&self) -> bool

Return whether the set contains no members.

Source

pub fn contains(&self, key: &K) -> bool

Return whether an equivalent member is present.

Source

pub fn insert(&self, key: K) -> bool

Insert key, returning whether it was newly added.

Source

pub fn remove(&self, key: &K) -> bool

Remove an equivalent member, returning whether it was present.

Source

pub fn iter(&self) -> OrderedSetIter<K>

Create a live insertion-order iterator.

Source

pub fn compact(&self, max_work: usize) -> CompactionResult

Compact tombstones under the table’s position and work rules.

Trait Implementations§

Source§

impl<K: Debug, E: Debug> Debug for OrderedSet<K, E>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<K, E> !RefUnwindSafe for OrderedSet<K, E>

§

impl<K, E> !Send for OrderedSet<K, E>

§

impl<K, E> !Sync for OrderedSet<K, E>

§

impl<K, E> !UnwindSafe for OrderedSet<K, E>

§

impl<K, E> Freeze for OrderedSet<K, E>
where E: Freeze,

§

impl<K, E> Unpin for OrderedSet<K, E>
where E: Unpin,

§

impl<K, E> UnsafeUnpin for OrderedSet<K, E>
where E: UnsafeUnpin,

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