pub struct Ratio(/* private fields */);Expand description
Decimal constrained to 0 <= x <= 1.
Implementations§
Source§impl Ratio
impl Ratio
Sourcepub fn new(value: Decimal) -> Result<Self, DecimalConstraintError>
pub fn new(value: Decimal) -> Result<Self, DecimalConstraintError>
Sourcepub const fn as_decimal(&self) -> &Decimal
pub const fn as_decimal(&self) -> &Decimal
Returns the wrapped decimal by reference.
Sourcepub const fn into_inner(self) -> Decimal
Available on non-crate feature bigdecimal only.
pub const fn into_inner(self) -> Decimal
bigdecimal only.Returns the wrapped decimal.
Trait Implementations§
impl Copy for Ratio
Source§impl Decimal128Mantissa for Ratio
impl Decimal128Mantissa for Ratio
Source§impl<'de> Deserialize<'de> for Ratio
impl<'de> Deserialize<'de> for Ratio
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 Ratio
Source§impl From<Ratio> for NonNegativeDecimal
impl From<Ratio> for NonNegativeDecimal
Source§impl PartialOrd for Ratio
impl PartialOrd for Ratio
impl StructuralPartialEq for Ratio
Auto Trait Implementations§
impl Freeze for Ratio
impl RefUnwindSafe for Ratio
impl Send for Ratio
impl Sync for Ratio
impl Unpin for Ratio
impl UnsafeUnpin for Ratio
impl UnwindSafe for Ratio
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