Struct sortedlist_rs::SortedList
source · pub struct SortedList<T>where
T: Ord,{ /* private fields */ }
Implementations
sourceimpl<T> SortedList<T>where
T: Ord,
impl<T> SortedList<T>where
T: Ord,
sourcepub fn kth_smallest(&self, k: usize) -> &T
pub fn kth_smallest(&self, k: usize) -> &T
Find the k-th smallest (0-indexed) element in the SortedList.
sourcepub fn remove(&mut self, k: usize) -> T
pub fn remove(&mut self, k: usize) -> T
Pops the k-th smallest (0-indexed) element from the SortedList.
sourcepub fn binary_search(&self, element: &T) -> Result<usize, usize>
pub fn binary_search(&self, element: &T) -> Result<usize, usize>
Binary searches the given element in the SortedList. Returns Ok(i) for exact match, Err(i) otherwise.
sourcepub fn last(&self) -> Option<&T>
pub fn last(&self) -> Option<&T>
Returns the last element of the SortedList, i.e. the largest element.
Trait Implementations
sourceimpl<T> Debug for SortedList<T>where
T: Ord + Debug,
impl<T> Debug for SortedList<T>where
T: Ord + Debug,
sourceimpl<T> Default for SortedList<T>where
T: Ord,
impl<T> Default for SortedList<T>where
T: Ord,
Auto Trait Implementations
impl<T> RefUnwindSafe for SortedList<T>where
T: RefUnwindSafe,
impl<T> Send for SortedList<T>where
T: Send,
impl<T> Sync for SortedList<T>where
T: Sync,
impl<T> Unpin for SortedList<T>where
T: Unpin,
impl<T> UnwindSafe for SortedList<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more