[][src]Struct sorted_vec::SortedSet

pub struct SortedSet<T: Ord> { /* fields omitted */ }

Forward sorted set

Implementations

impl<T: Ord> SortedSet<T>[src]

pub fn new() -> Self[src]

pub fn with_capacity(capacity: usize) -> Self[src]

pub fn from_unsorted(vec: Vec<T>) -> Self[src]

Uses sort_unstable() to sort in place and dedup() to remove duplicates.

pub fn insert(&mut self, element: T) -> usize[src]

Insert an element into sorted position, returning the order index at which it was placed.

pub fn find_or_insert(&mut self, element: T) -> Result<usize, usize>[src]

Find the element and return the index with Ok, otherwise insert the element and return the new element index with Err.

pub fn remove_item(&mut self, item: &T) -> Option<T>[src]

pub fn remove_index(&mut self, index: usize) -> T[src]

Panics if index is out of bounds

pub fn pop(&mut self) -> Option<T>[src]

pub fn clear(&mut self)[src]

pub fn drain<R>(&mut self, range: R) -> Drain<'_, T> where
    R: RangeBounds<usize>, 
[src]

pub fn retain<F>(&mut self, f: F) where
    F: FnMut(&T) -> bool
[src]

pub fn into_vec(self) -> Vec<T>[src]

NOTE: to_vec() is a slice method that is accessible through deref, use this instead to avoid cloning

pub fn mutate_vec<F, O>(&mut self, f: F) -> O where
    F: FnOnce(&mut Vec<T>) -> O, 
[src]

Apply a closure mutating the sorted vector and use sort_unstable() to re-sort the mutated vector and dedup() to remove any duplicate values

Methods from Deref<Target = SortedVec<T>>

Trait Implementations

impl<T: Clone + Ord> Clone for SortedSet<T>[src]

impl<T: Debug + Ord> Debug for SortedSet<T>[src]

impl<T: Ord> Default for SortedSet<T>[src]

impl<T: Ord> Deref for SortedSet<T>[src]

type Target = SortedVec<T>

The resulting type after dereferencing.

impl<T: Eq + Ord> Eq for SortedSet<T>[src]

impl<T: Ord> Extend<T> for SortedSet<T>[src]

impl<T: Ord> From<Vec<T, Global>> for SortedSet<T>[src]

impl<T: Ord + Hash> Hash for SortedSet<T>[src]

impl<T: Ord> Ord for SortedSet<T>[src]

impl<T: PartialEq + Ord> PartialEq<SortedSet<T>> for SortedSet<T>[src]

impl<T: PartialOrd + Ord> PartialOrd<SortedSet<T>> for SortedSet<T>[src]

impl<T: Ord> StructuralEq for SortedSet<T>[src]

impl<T: Ord> StructuralPartialEq for SortedSet<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for SortedSet<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for SortedSet<T> where
    T: Send
[src]

impl<T> Sync for SortedSet<T> where
    T: Sync
[src]

impl<T> Unpin for SortedSet<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for SortedSet<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.