pub struct PerThousandRatio { /* private fields */ }Expand description
Fixed-point ratio stored as parts per thousand.
Implementations§
Source§impl PerThousandRatio
impl PerThousandRatio
Sourcepub const fn from_per_thousand(per_thousand: u16) -> Self
pub const fn from_per_thousand(per_thousand: u16) -> Self
Create a ratio from parts per thousand.
Sourcepub const fn per_thousand(self) -> u16
pub const fn per_thousand(self) -> u16
Return the ratio as parts per thousand.
Sourcepub fn as_fraction(self) -> f64
pub fn as_fraction(self) -> f64
Return the ratio as a floating point value for calculations.
Trait Implementations§
Source§impl Clone for PerThousandRatio
impl Clone for PerThousandRatio
Source§fn clone(&self) -> PerThousandRatio
fn clone(&self) -> PerThousandRatio
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 PerThousandRatio
Source§impl Debug for PerThousandRatio
impl Debug for PerThousandRatio
Source§impl Default for PerThousandRatio
impl Default for PerThousandRatio
Source§impl<'de> Deserialize<'de> for PerThousandRatio
impl<'de> Deserialize<'de> for PerThousandRatio
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
impl Eq for PerThousandRatio
Source§impl Ord for PerThousandRatio
impl Ord for PerThousandRatio
Source§fn cmp(&self, other: &PerThousandRatio) -> Ordering
fn cmp(&self, other: &PerThousandRatio) -> Ordering
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 PartialEq for PerThousandRatio
impl PartialEq for PerThousandRatio
Source§impl PartialOrd for PerThousandRatio
impl PartialOrd for PerThousandRatio
Source§impl Serialize for PerThousandRatio
impl Serialize for PerThousandRatio
impl StructuralPartialEq for PerThousandRatio
Auto Trait Implementations§
impl Freeze for PerThousandRatio
impl RefUnwindSafe for PerThousandRatio
impl Send for PerThousandRatio
impl Sync for PerThousandRatio
impl Unpin for PerThousandRatio
impl UnsafeUnpin for PerThousandRatio
impl UnwindSafe for PerThousandRatio
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