pub struct Score {
pub value: f64,
pub label: Option<String>,
}Expand description
Evaluation score (0.0–1.0, 1.0 is best)
Fields§
§value: f64Score value (0.0–1.0)
label: Option<String>Optional score label
Implementations§
Source§impl Score
impl Score
Sourcepub fn new(value: f64) -> Self
pub fn new(value: f64) -> Self
Constructs a score between 0.0 and 1.0.
P2-8: Rust’s f64::clamp(0.0, 1.0) returns NaN for NaN input, polluting
the summary mean/std. A NaN pre-check is done here, treating it as 0.0
(negative/positive infinity are left to clamp to converge to the bounds).
Sourcepub fn with_label(self, label: impl Into<String>) -> Self
pub fn with_label(self, label: impl Into<String>) -> Self
Attaches a score label (builder style).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Score
impl<'de> Deserialize<'de> for Score
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
Auto Trait Implementations§
impl Freeze for Score
impl RefUnwindSafe for Score
impl Send for Score
impl Sync for Score
impl Unpin for Score
impl UnsafeUnpin for Score
impl UnwindSafe for Score
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