pub struct CoherenceScore(/* private fields */);Expand description
A coherence score in the range [0.0, 1.0].
Stored internally as a u16 fixed-point value (0..=10000) to avoid
floating-point dependencies in no_std contexts. 1 basis point = 0.0001.
Implementations§
Source§impl CoherenceScore
impl CoherenceScore
Sourcepub const DEFAULT_THRESHOLD: Self
pub const DEFAULT_THRESHOLD: Self
Default coherence threshold below which partitions are deprioritized.
Sourcepub const DEFAULT_MERGE_THRESHOLD: Self
pub const DEFAULT_MERGE_THRESHOLD: Self
Default merge threshold. Partitions must exceed this to merge (DC-11).
Sourcepub const fn from_basis_points(bp: u16) -> Self
pub const fn from_basis_points(bp: u16) -> Self
Create a coherence score from a fixed-point value (0..=10000).
Values above 10000 are clamped to 10000.
Sourcepub const fn as_basis_points(self) -> u16
pub const fn as_basis_points(self) -> u16
Return the raw basis-point value.
Sourcepub const fn meets_threshold(self, threshold: Self) -> bool
pub const fn meets_threshold(self, threshold: Self) -> bool
Check whether this score meets the given threshold.
Sourcepub const fn is_coherent(self) -> bool
pub const fn is_coherent(self) -> bool
Check whether this score is above the default coherence threshold.
Trait Implementations§
Source§impl Clone for CoherenceScore
impl Clone for CoherenceScore
Source§fn clone(&self) -> CoherenceScore
fn clone(&self) -> CoherenceScore
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 moreimpl Copy for CoherenceScore
Source§impl Debug for CoherenceScore
impl Debug for CoherenceScore
impl Eq for CoherenceScore
Source§impl Hash for CoherenceScore
impl Hash for CoherenceScore
Source§impl Ord for CoherenceScore
impl Ord for CoherenceScore
Source§fn cmp(&self, other: &CoherenceScore) -> Ordering
fn cmp(&self, other: &CoherenceScore) -> Ordering
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 PartialEq for CoherenceScore
impl PartialEq for CoherenceScore
Source§impl PartialOrd for CoherenceScore
impl PartialOrd for CoherenceScore
impl StructuralPartialEq for CoherenceScore
Auto Trait Implementations§
impl Freeze for CoherenceScore
impl RefUnwindSafe for CoherenceScore
impl Send for CoherenceScore
impl Sync for CoherenceScore
impl Unpin for CoherenceScore
impl UnsafeUnpin for CoherenceScore
impl UnwindSafe for CoherenceScore
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