pub struct PowCapabilityScore {
pub value: f64,
pub band: PowCapabilityBand,
}Expand description
A PoW capability score plus the band label that the
scorer derived from it.
This is the unit the policy mapper consumes — the
mapper does not need to know which scorer produced the
score. Helpers like
score_from_profile
build a PowCapabilityScore from a profile + scorer
pair so callers can chain the two.
Fields§
§value: f64Unit-interval score in [0.0, 1.0].
band: PowCapabilityBandCoarse band derived from value.
Implementations§
Source§impl PowCapabilityScore
impl PowCapabilityScore
Sourcepub fn new(value: f64) -> Self
pub fn new(value: f64) -> Self
Build a score + band directly (no profile required).
The band is recomputed from the score so the two
fields cannot drift out of sync. A value equal to
SPARSE_FALLBACK_SCORE (the documented “no
signal” default) always maps to
PowCapabilityBand::Unknown.
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
true if the score is the sparse-telemetry default
(SPARSE_FALLBACK_SCORE) or the band is
PowCapabilityBand::Unknown.
Trait Implementations§
Source§impl Clone for PowCapabilityScore
impl Clone for PowCapabilityScore
Source§fn clone(&self) -> PowCapabilityScore
fn clone(&self) -> PowCapabilityScore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PowCapabilityScore
impl Debug for PowCapabilityScore
Source§impl<'de> Deserialize<'de> for PowCapabilityScore
impl<'de> Deserialize<'de> for PowCapabilityScore
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for PowCapabilityScore
impl PartialEq for PowCapabilityScore
Source§impl Serialize for PowCapabilityScore
impl Serialize for PowCapabilityScore
impl Copy for PowCapabilityScore
impl StructuralPartialEq for PowCapabilityScore
Auto Trait Implementations§
impl Freeze for PowCapabilityScore
impl RefUnwindSafe for PowCapabilityScore
impl Send for PowCapabilityScore
impl Sync for PowCapabilityScore
impl Unpin for PowCapabilityScore
impl UnsafeUnpin for PowCapabilityScore
impl UnwindSafe for PowCapabilityScore
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