[−][src]Struct sorted_vec::ReverseSortedSet
Reverse sorted set
Implementations
impl<T: Ord> ReverseSortedSet<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]
R: RangeBounds<usize>,
pub fn retain<F>(&mut self, f: F) where
F: FnMut(&T) -> bool,
[src]
F: FnMut(&T) -> bool,
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]
F: FnOnce(&mut Vec<T>) -> O,
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 = ReverseSortedVec<T>>
Trait Implementations
impl<T: Clone + Ord> Clone for ReverseSortedSet<T>
[src]
pub fn clone(&self) -> ReverseSortedSet<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug + Ord> Debug for ReverseSortedSet<T>
[src]
impl<T: Ord> Default for ReverseSortedSet<T>
[src]
impl<T: Ord> Deref for ReverseSortedSet<T>
[src]
type Target = ReverseSortedVec<T>
The resulting type after dereferencing.
pub fn deref(&self) -> &ReverseSortedVec<T>
[src]
impl<T: Eq + Ord> Eq for ReverseSortedSet<T>
[src]
impl<T: Ord> Extend<T> for ReverseSortedSet<T>
[src]
pub fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
[src]
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl<T: Ord> From<Vec<T, Global>> for ReverseSortedSet<T>
[src]
impl<T: Ord + Hash> Hash for ReverseSortedSet<T>
[src]
pub fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: Ord> Ord for ReverseSortedSet<T>
[src]
pub fn cmp(&self, other: &ReverseSortedSet<T>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T: PartialEq + Ord> PartialEq<ReverseSortedSet<T>> for ReverseSortedSet<T>
[src]
pub fn eq(&self, other: &ReverseSortedSet<T>) -> bool
[src]
pub fn ne(&self, other: &ReverseSortedSet<T>) -> bool
[src]
impl<T: PartialOrd + Ord> PartialOrd<ReverseSortedSet<T>> for ReverseSortedSet<T>
[src]
pub fn partial_cmp(&self, other: &ReverseSortedSet<T>) -> Option<Ordering>
[src]
pub fn lt(&self, other: &ReverseSortedSet<T>) -> bool
[src]
pub fn le(&self, other: &ReverseSortedSet<T>) -> bool
[src]
pub fn gt(&self, other: &ReverseSortedSet<T>) -> bool
[src]
pub fn ge(&self, other: &ReverseSortedSet<T>) -> bool
[src]
impl<T: Ord> StructuralEq for ReverseSortedSet<T>
[src]
impl<T: Ord> StructuralPartialEq for ReverseSortedSet<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for ReverseSortedSet<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for ReverseSortedSet<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for ReverseSortedSet<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for ReverseSortedSet<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for ReverseSortedSet<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,