pub struct MinScored<K, T>(pub K, pub T);
Expand description
MinScored<K, T>
holds a score K
and a scored object T
in
a pair for use with a BinaryHeap
.
MinScored
compares in reverse order by the score, so that we can
use BinaryHeap
as a min-heap to extract the score-value pair with the
least score.
Note: MinScored
implements a total order (Ord
), so that it is
possible to use float types as scores.
Tuple Fields§
§0: K
§1: T
Trait Implementations§
source§impl<K: PartialOrd, T> Ord for MinScored<K, T>
impl<K: PartialOrd, T> Ord for MinScored<K, T>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<K: PartialOrd, T> PartialEq for MinScored<K, T>
impl<K: PartialOrd, T> PartialEq for MinScored<K, T>
source§impl<K: PartialOrd, T> PartialOrd for MinScored<K, T>
impl<K: PartialOrd, T> PartialOrd for MinScored<K, T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<K: Copy, T: Copy> Copy for MinScored<K, T>
impl<K: PartialOrd, T> Eq for MinScored<K, T>
Auto Trait Implementations§
impl<K, T> Freeze for MinScored<K, T>
impl<K, T> RefUnwindSafe for MinScored<K, T>where
K: RefUnwindSafe,
T: RefUnwindSafe,
impl<K, T> Send for MinScored<K, T>
impl<K, T> Sync for MinScored<K, T>
impl<K, T> Unpin for MinScored<K, T>
impl<K, T> UnwindSafe for MinScored<K, T>where
K: UnwindSafe,
T: UnwindSafe,
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.