pub struct Score { /* private fields */ }Expand description
A score for Benchmark::try_match.
A Score is in one of two states: success or failure. Lower scores indicate better
matches in both states. In the failure case, scores rank “near misses” for diagnostics.
Score::penalizeincreases the score of a successful match.Score::failtransitions to (or worsens) the failure state.
The current state can be queried with Score::is_success.
Implementations§
Source§impl Score
impl Score
Sourcepub fn penalize(&mut self, by: u32)
pub fn penalize(&mut self, by: u32)
If the score is in the “success” state, penalize it by by.
Has no effect if the score is already in the “failure” state.
Sourcepub fn fail(&mut self, by: u32, reason: &dyn Display)
pub fn fail(&mut self, by: u32, reason: &dyn Display)
Transition the score to the “failure” state with penalty by and a reason.
If the score is already in the “failure” state, by is added to the existing
failure score and reason is appended to the list of failure reasons.
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Return true if self is in the “success” state. Returning false implies the
“failure” state.
Trait Implementations§
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