pub struct PercentageF64(/* private fields */);Expand description
Percentage value as f64 in the range 0.0..=100.0.
Use this when decimal precision is required. For integer percentages, use
Percent.
Implementations§
Source§impl PercentageF64
impl PercentageF64
Sourcepub fn new(value: f64) -> PrimitiveResult<Self>
pub fn new(value: f64) -> PrimitiveResult<Self>
Creates a PercentageF64. Returns Invalid if value is not finite
or is outside 0.0..=100.0.
Sourcepub fn as_fraction(self) -> f64
pub fn as_fraction(self) -> f64
Returns the value as a fraction between 0.0 and 1.0.
Trait Implementations§
Source§impl Clone for PercentageF64
impl Clone for PercentageF64
Source§fn clone(&self) -> PercentageF64
fn clone(&self) -> PercentageF64
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 PercentageF64
Source§impl Debug for PercentageF64
impl Debug for PercentageF64
Source§impl Display for PercentageF64
impl Display for PercentageF64
Source§impl PartialEq for PercentageF64
impl PartialEq for PercentageF64
Source§fn eq(&self, other: &PercentageF64) -> bool
fn eq(&self, other: &PercentageF64) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for PercentageF64
impl PartialOrd for PercentageF64
impl StructuralPartialEq for PercentageF64
Auto Trait Implementations§
impl Freeze for PercentageF64
impl RefUnwindSafe for PercentageF64
impl Send for PercentageF64
impl Sync for PercentageF64
impl Unpin for PercentageF64
impl UnsafeUnpin for PercentageF64
impl UnwindSafe for PercentageF64
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