pub struct Percent(/* private fields */);Expand description
Percentage value from 0 to 100 inclusive.
Implementations§
Source§impl Percent
impl Percent
Sourcepub const fn new(value: u8) -> PrimitiveResult<Self>
pub const fn new(value: u8) -> PrimitiveResult<Self>
Creates a new percentage value.
Sourcepub fn as_fraction(self) -> f64
pub fn as_fraction(self) -> f64
Returns the percentage as a fraction between 0.0 and 1.0.
Trait Implementations§
impl Copy for Percent
impl Eq for Percent
Source§impl Ord for Percent
impl Ord for Percent
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 Percent
impl PartialOrd for Percent
impl StructuralPartialEq for Percent
Auto Trait Implementations§
impl Freeze for Percent
impl RefUnwindSafe for Percent
impl Send for Percent
impl Sync for Percent
impl Unpin for Percent
impl UnsafeUnpin for Percent
impl UnwindSafe for Percent
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