pub struct ScoredEntry<T> { /* private fields */ }Expand description
A wrapper for scored candidates that implements deterministic Ord.
This struct caches the score as a DeterministicScore (i64 fixed-point) for
cross-platform deterministic ordering, along with the UUID for tie-breaking.
§Ordering
ScoredEntry orders by:
- Score descending (higher scores first)
- UUID ascending (lower UUIDs first for tie-breaking)
Implementations§
Source§impl<T: HasId> ScoredEntry<T>
impl<T: HasId> ScoredEntry<T>
Sourcepub fn into_candidate(self) -> T
pub fn into_candidate(self) -> T
Consume and return the candidate.
Sourcepub fn det_score(&self) -> DeterministicScore
pub fn det_score(&self) -> DeterministicScore
Get the deterministic fixed-point score.
Trait Implementations§
Source§impl<T: Clone> Clone for ScoredEntry<T>
impl<T: Clone> Clone for ScoredEntry<T>
Source§fn clone(&self) -> ScoredEntry<T>
fn clone(&self) -> ScoredEntry<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for ScoredEntry<T>
impl<T: Debug> Debug for ScoredEntry<T>
Source§impl<T> Hash for ScoredEntry<T>
impl<T> Hash for ScoredEntry<T>
Source§impl<T> Ord for ScoredEntry<T>
impl<T> Ord for ScoredEntry<T>
Source§fn cmp(&self, other: &Self) -> Ordering
fn cmp(&self, other: &Self) -> Ordering
Compare entries for use with BinaryHeap and sorted collections.
Higher scores are “greater” (popped first from max-heap). On equal scores, lower UUIDs are “greater” (popped first from max-heap). NaN scores map to DeterministicScore::ZERO and sort after all normal values.
1.21.0 (const: unstable) · 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<T> PartialEq for ScoredEntry<T>
impl<T> PartialEq for ScoredEntry<T>
Source§impl<T> PartialOrd for ScoredEntry<T>
impl<T> PartialOrd for ScoredEntry<T>
impl<T: Copy> Copy for ScoredEntry<T>
impl<T> Eq for ScoredEntry<T>
Auto Trait Implementations§
impl<T> Freeze for ScoredEntry<T>where
T: Freeze,
impl<T> RefUnwindSafe for ScoredEntry<T>where
T: RefUnwindSafe,
impl<T> Send for ScoredEntry<T>where
T: Send,
impl<T> Sync for ScoredEntry<T>where
T: Sync,
impl<T> Unpin for ScoredEntry<T>where
T: Unpin,
impl<T> UnsafeUnpin for ScoredEntry<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ScoredEntry<T>where
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