pub struct BinaryHeap<T, const N: usize> { /* private fields */ }Expand description
An array-based binary heap, with N elements stored inline.
Implementations§
Source§impl<T: Clone + Copy + Ord, const N: usize> BinaryHeap<T, N>
impl<T: Clone + Copy + Ord, const N: usize> BinaryHeap<T, N>
Sourcepub fn push(&mut self, value: T) -> Result<(), KernelError>
pub fn push(&mut self, value: T) -> Result<(), KernelError>
Push a value onto the binary heap.
value - The value to push onto the binary heap.
Returns Ok(()) if the value was pushed onto the binary heap, or an error if the heap cannot be extended (e.g. OOM).
Sourcepub fn pop(&mut self) -> Option<T>
pub fn pop(&mut self) -> Option<T>
Pop the smallest value from the binary heap.
Returns the smallest value in the binary heap, or None if the heap is empty.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Check if the binary heap is empty.
Returns true if the binary heap is empty, false otherwise.
Auto Trait Implementations§
impl<T, const N: usize> Freeze for BinaryHeap<T, N>where
T: Freeze,
impl<T, const N: usize> RefUnwindSafe for BinaryHeap<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> !Send for BinaryHeap<T, N>
impl<T, const N: usize> !Sync for BinaryHeap<T, N>
impl<T, const N: usize> Unpin for BinaryHeap<T, N>where
T: Unpin,
impl<T, const N: usize> UnwindSafe for BinaryHeap<T, N>where
T: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more