pub struct BinHeap<K, V, ID = u32> { /* private fields */ }
Expand description

Simply binary heap data structure.

Implementations§

source§

impl<K, V, ID> BinHeap<K, V, ID>

source

pub fn new() -> Self

Trait Implementations§

source§

impl<K, V, ID> Default for BinHeap<K, V, ID>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<K, V, ID> ItemPriQueue<K, V> for BinHeap<K, V, ID>where K: Clone, V: PartialOrd + Clone, ID: FromPrimitive + ToPrimitive + Copy + Eq,

§

type Item = ID

Handle for an item in the queue.
source§

fn clear(&mut self)

Remove all elements from the queue.
source§

fn is_empty(&self) -> bool

Return true iff the queue contains no element.
source§

fn value(&self, item: &ID) -> &V

Return the current value associated with some item in the queue.
source§

fn push(&mut self, key: K, value: V) -> ID

Push the element with given key and value onto the queue. Read more
source§

fn decrease_key(&mut self, item: &mut ID, value: V) -> bool

Decrease the value of some item in the queue. Read more
source§

fn pop_min(&mut self) -> Option<(K, V)>

Remove and return the element with the smallest value from the queue or None if the queue is empty.

Auto Trait Implementations§

§

impl<K, V, ID> RefUnwindSafe for BinHeap<K, V, ID>where ID: RefUnwindSafe, K: RefUnwindSafe, V: RefUnwindSafe,

§

impl<K, V, ID> Send for BinHeap<K, V, ID>where ID: Send, K: Send, V: Send,

§

impl<K, V, ID> Sync for BinHeap<K, V, ID>where ID: Sync, K: Sync, V: Sync,

§

impl<K, V, ID> Unpin for BinHeap<K, V, ID>where ID: Unpin, K: Unpin, V: Unpin,

§

impl<K, V, ID> UnwindSafe for BinHeap<K, V, ID>where ID: UnwindSafe, K: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.