pub struct Quantile(/* private fields */);Expand description
A validated quantile value in the inclusive range 0.0..=1.0.
This newtype ensures that only valid quantile values (finite, non-NaN,
within [0.0, 1.0]) are used as keys in QuantilesResult. Because
NaN and infinity are excluded by construction, Quantile safely
implements Eq and Ord.
§Examples
use histogram::Quantile;
let q = Quantile::new(0.99).unwrap();
assert_eq!(q.as_f64(), 0.99);
// Invalid values are rejected
assert!(Quantile::new(1.5).is_err());
assert!(Quantile::new(f64::NAN).is_err());Implementations§
Trait Implementations§
Source§impl Ord for Quantile
impl Ord for Quantile
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 PartialOrd for Quantile
impl PartialOrd for Quantile
impl Copy for Quantile
impl Eq for Quantile
Auto Trait Implementations§
impl Freeze for Quantile
impl RefUnwindSafe for Quantile
impl Send for Quantile
impl Sync for Quantile
impl Unpin for Quantile
impl UnsafeUnpin for Quantile
impl UnwindSafe for Quantile
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