Struct dotreds_binary_heap_plus::BinaryHeap
source · [−]pub struct BinaryHeap<T, C = MaxComparator> where
C: Compare<T>, { /* private fields */ }Implementations
sourceimpl<T, C: Compare<T>> BinaryHeap<T, C>
impl<T, C: Compare<T>> BinaryHeap<T, C>
pub fn from_vec_cmp(vec: Vec<T>, cmp: C) -> Self
pub unsafe fn from_vec_cmp_raw(vec: Vec<T>, cmp: C, rebuild: bool) -> Self
sourceimpl<T: Ord> BinaryHeap<T>
impl<T: Ord> BinaryHeap<T>
pub fn new() -> Self
pub fn with_capacity(capacity: usize) -> Self
sourceimpl<T: Ord> BinaryHeap<T, MinComparator>
impl<T: Ord> BinaryHeap<T, MinComparator>
pub fn new_min() -> Self
pub fn with_capacity_min(capacity: usize) -> Self
sourceimpl<T, F> BinaryHeap<T, FnComparator<F>> where
F: Fn(&T, &T) -> Ordering,
impl<T, F> BinaryHeap<T, FnComparator<F>> where
F: Fn(&T, &T) -> Ordering,
pub fn new_by(f: F) -> Self
pub fn with_capacity_by(capacity: usize, f: F) -> Self
sourceimpl<T, F, K: Ord> BinaryHeap<T, KeyComparator<F>> where
F: Fn(&T) -> K,
impl<T, F, K: Ord> BinaryHeap<T, KeyComparator<F>> where
F: Fn(&T) -> K,
pub fn new_by_key(f: F) -> Self
pub fn with_capacity_by_key(capacity: usize, f: F) -> Self
sourceimpl<T, C: Compare<T>> BinaryHeap<T, C>
impl<T, C: Compare<T>> BinaryHeap<T, C>
pub fn replace_cmp(&mut self, cmp: C)
pub unsafe fn replace_cmp_raw(&mut self, cmp: C, rebuild: bool)
pub fn iter(&self) -> Iter<'_, T>ⓘNotable traits for Iter<'a, T>impl<'a, T> Iterator for Iter<'a, T> type Item = &'a T;
pub fn into_iter_sorted(self) -> IntoIterSorted<T, C>ⓘNotable traits for IntoIterSorted<T, C>impl<T, C: Compare<T>> Iterator for IntoIterSorted<T, C> type Item = T;
pub fn peek(&self) -> Option<&T>
pub fn peek_mut(&mut self) -> Option<PeekMut<'_, T, C>>
pub fn capacity(&self) -> usize
pub fn reserve(&mut self, additional: usize)
pub fn shrink_to_fit(&mut self)
pub fn pop(&mut self) -> Option<T>
pub fn push(&mut self, item: T)
pub fn into_vec(self) -> Vec<T>
pub fn into_sorted_vec(self) -> Vec<T>
pub fn sift_up(&mut self, start: usize, pos: usize) -> usize
sourcepub fn sift_down_range(&mut self, pos: usize, end: usize)
pub fn sift_down_range(&mut self, pos: usize, end: usize)
Take an element at pos and move it down the heap,
while its children are larger.
pub fn sift_down(&mut self, pos: usize)
sourcepub fn sift_down_to_bottom(&mut self, pos: usize)
pub fn sift_down_to_bottom(&mut self, pos: usize)
Take an element at pos and move it all the way down the heap,
then sift it up to its position.
Note: This is faster when the element is known to be large / should be closer to the bottom.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn drain(&mut self) -> Drain<'_, T>ⓘNotable traits for Drain<'a, T>impl<'a, T: 'a> Iterator for Drain<'a, T> type Item = T;
pub fn clear(&mut self)
pub fn append(&mut self, other: &mut Self)
Trait Implementations
sourceimpl<T: Debug, C: Compare<T>> Debug for BinaryHeap<T, C>
impl<T: Debug, C: Compare<T>> Debug for BinaryHeap<T, C>
sourceimpl<T: Ord> Default for BinaryHeap<T>
impl<T: Ord> Default for BinaryHeap<T>
sourcefn default() -> BinaryHeap<T>
fn default() -> BinaryHeap<T>
Returns the “default value” for a type. Read more
sourceimpl<'a, T: 'a + Copy, C: Compare<T>> Extend<&'a T> for BinaryHeap<T, C>
impl<'a, T: 'a + Copy, C: Compare<T>> Extend<&'a T> for BinaryHeap<T, C>
sourcefn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl<T, C: Compare<T>> Extend<T> for BinaryHeap<T, C>
impl<T, C: Compare<T>> Extend<T> for BinaryHeap<T, C>
sourcefn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl<T: Ord> FromIterator<T> for BinaryHeap<T>
impl<T: Ord> FromIterator<T> for BinaryHeap<T>
sourcefn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
sourceimpl<T, C: Compare<T>> IntoIterator for BinaryHeap<T, C>
impl<T, C: Compare<T>> IntoIterator for BinaryHeap<T, C>
sourceimpl<'a, T, C: Compare<T>> IntoIterator for &'a BinaryHeap<T, C>
impl<'a, T, C: Compare<T>> IntoIterator for &'a BinaryHeap<T, C>
Auto Trait Implementations
impl<T, C> RefUnwindSafe for BinaryHeap<T, C> where
C: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, C> Send for BinaryHeap<T, C> where
C: Send,
T: Send,
impl<T, C> Sync for BinaryHeap<T, C> where
C: Sync,
T: Sync,
impl<T, C> Unpin for BinaryHeap<T, C> where
C: Unpin,
T: Unpin,
impl<T, C> UnwindSafe for BinaryHeap<T, C> where
C: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more