Struct fixnum::FixedPoint
source · [−]pub struct FixedPoint<I, P> { /* private fields */ }
i128
or i64
or i32
or i16
only.Expand description
Abstraction over fixed point numbers of arbitrary (but only compile-time specified) size and precision.
The internal representation is a fixed point decimal number,
an integer value pre-multiplied by 10 ^ PRECISION
,
where PRECISION
is a compile-time-defined decimal places count.
Maximal possible value: MAX = (2 ^ (BITS_COUNT - 1) - 1) / 10 ^ PRECISION
Maximal possible calculation error: ERROR_MAX = 0.5 / (10 ^ PRECISION)
E.g. for i64
with 9 decimal places:
MAX = (2 ^ (64 - 1) - 1) / 1e9 = 9223372036.854775807 ~ 9.2e9
ERROR_MAX = 0.5 / 1e9 = 5e-10
Implementations
sourceimpl<I, P> FixedPoint<I, P>
impl<I, P> FixedPoint<I, P>
sourceimpl<P: Precision> FixedPoint<i16, P>
impl<P: Precision> FixedPoint<i16, P>
sourceimpl<P: Precision> FixedPoint<i16, P>
impl<P: Precision> FixedPoint<i16, P>
pub fn recip(
self,
mode: RoundMode
) -> Result<FixedPoint<i16, P>, ArithmeticError>
i16
only.sourcepub fn cneg(self) -> Result<FixedPoint<i16, P>, ArithmeticError>
Available on crate feature i16
only.
pub fn cneg(self) -> Result<FixedPoint<i16, P>, ArithmeticError>
i16
only.Checked negation. Returns Err
on overflow (you can’t negate MIN
value).
pub fn half_sum(
a: FixedPoint<i16, P>,
b: FixedPoint<i16, P>,
mode: RoundMode
) -> FixedPoint<i16, P>
i16
only.sourcepub fn integral(self, mode: RoundMode) -> i16
Available on crate feature i16
only.
pub fn integral(self, mode: RoundMode) -> i16
i16
only.Takes rounded integral part of the number.
use fixnum::{FixedPoint, typenum::U9, ops::RoundMode::*};
type Amount = FixedPoint<i64, U9>;
let a: Amount = "8273.519".parse()?;
assert_eq!(a.integral(Floor), 8273);
assert_eq!(a.integral(Ceil), 8274);
let a: Amount = "-8273.519".parse()?;
assert_eq!(a.integral(Floor), -8274);
assert_eq!(a.integral(Ceil), -8273);
pub fn round_towards_zero_by(
self,
precision: FixedPoint<i16, P>
) -> FixedPoint<i16, P>
i16
only.pub fn next_power_of_ten(self) -> Result<FixedPoint<i16, P>, ArithmeticError>
i16
only.pub fn rounding_from_f64(
value: f64
) -> Result<FixedPoint<i16, P>, ArithmeticError>
Use TryFrom
instead
i16
and std
only.pub fn to_f64(self) -> f64
Use From
instead
i16
only.pub fn rounding_to_i64(self) -> i64
i16
only.pub fn abs(self) -> Result<Self, ArithmeticError>
i16
only.sourceimpl<P: Precision> FixedPoint<i16, P>
impl<P: Precision> FixedPoint<i16, P>
pub fn from_decimal(
mantissa: i16,
exponent: i32
) -> Result<FixedPoint<i16, P>, ConvertError>
i16
only.sourceimpl<P: Precision> FixedPoint<i32, P>
impl<P: Precision> FixedPoint<i32, P>
sourceimpl<P: Precision> FixedPoint<i32, P>
impl<P: Precision> FixedPoint<i32, P>
pub fn recip(
self,
mode: RoundMode
) -> Result<FixedPoint<i32, P>, ArithmeticError>
i32
only.sourcepub fn cneg(self) -> Result<FixedPoint<i32, P>, ArithmeticError>
Available on crate feature i32
only.
pub fn cneg(self) -> Result<FixedPoint<i32, P>, ArithmeticError>
i32
only.Checked negation. Returns Err
on overflow (you can’t negate MIN
value).
pub fn half_sum(
a: FixedPoint<i32, P>,
b: FixedPoint<i32, P>,
mode: RoundMode
) -> FixedPoint<i32, P>
i32
only.sourcepub fn integral(self, mode: RoundMode) -> i32
Available on crate feature i32
only.
pub fn integral(self, mode: RoundMode) -> i32
i32
only.Takes rounded integral part of the number.
use fixnum::{FixedPoint, typenum::U9, ops::RoundMode::*};
type Amount = FixedPoint<i64, U9>;
let a: Amount = "8273.519".parse()?;
assert_eq!(a.integral(Floor), 8273);
assert_eq!(a.integral(Ceil), 8274);
let a: Amount = "-8273.519".parse()?;
assert_eq!(a.integral(Floor), -8274);
assert_eq!(a.integral(Ceil), -8273);
pub fn round_towards_zero_by(
self,
precision: FixedPoint<i32, P>
) -> FixedPoint<i32, P>
i32
only.pub fn next_power_of_ten(self) -> Result<FixedPoint<i32, P>, ArithmeticError>
i32
only.pub fn rounding_from_f64(
value: f64
) -> Result<FixedPoint<i32, P>, ArithmeticError>
Use TryFrom
instead
i32
and std
only.pub fn to_f64(self) -> f64
Use From
instead
i32
only.pub fn rounding_to_i64(self) -> i64
i32
only.pub fn abs(self) -> Result<Self, ArithmeticError>
i32
only.sourceimpl<P: Precision> FixedPoint<i32, P>
impl<P: Precision> FixedPoint<i32, P>
pub fn from_decimal(
mantissa: i32,
exponent: i32
) -> Result<FixedPoint<i32, P>, ConvertError>
i32
only.sourceimpl<P: Precision> FixedPoint<i64, P>
impl<P: Precision> FixedPoint<i64, P>
sourceimpl<P: Precision> FixedPoint<i64, P>
impl<P: Precision> FixedPoint<i64, P>
pub fn recip(
self,
mode: RoundMode
) -> Result<FixedPoint<i64, P>, ArithmeticError>
i64
only.sourcepub fn cneg(self) -> Result<FixedPoint<i64, P>, ArithmeticError>
Available on crate feature i64
only.
pub fn cneg(self) -> Result<FixedPoint<i64, P>, ArithmeticError>
i64
only.Checked negation. Returns Err
on overflow (you can’t negate MIN
value).
pub fn half_sum(
a: FixedPoint<i64, P>,
b: FixedPoint<i64, P>,
mode: RoundMode
) -> FixedPoint<i64, P>
i64
only.sourcepub fn integral(self, mode: RoundMode) -> i64
Available on crate feature i64
only.
pub fn integral(self, mode: RoundMode) -> i64
i64
only.Takes rounded integral part of the number.
use fixnum::{FixedPoint, typenum::U9, ops::RoundMode::*};
type Amount = FixedPoint<i64, U9>;
let a: Amount = "8273.519".parse()?;
assert_eq!(a.integral(Floor), 8273);
assert_eq!(a.integral(Ceil), 8274);
let a: Amount = "-8273.519".parse()?;
assert_eq!(a.integral(Floor), -8274);
assert_eq!(a.integral(Ceil), -8273);
pub fn round_towards_zero_by(
self,
precision: FixedPoint<i64, P>
) -> FixedPoint<i64, P>
i64
only.pub fn next_power_of_ten(self) -> Result<FixedPoint<i64, P>, ArithmeticError>
i64
only.pub fn rounding_from_f64(
value: f64
) -> Result<FixedPoint<i64, P>, ArithmeticError>
Use TryFrom
instead
i64
and std
only.pub fn to_f64(self) -> f64
Use From
instead
i64
only.pub fn rounding_to_i64(self) -> i64
i64
only.pub fn abs(self) -> Result<Self, ArithmeticError>
i64
only.sourceimpl<P: Precision> FixedPoint<i64, P>
impl<P: Precision> FixedPoint<i64, P>
pub fn from_decimal(
mantissa: i64,
exponent: i32
) -> Result<FixedPoint<i64, P>, ConvertError>
i64
only.sourceimpl<P: Precision> FixedPoint<i128, P>
impl<P: Precision> FixedPoint<i128, P>
sourceimpl<P: Precision> FixedPoint<i128, P>
impl<P: Precision> FixedPoint<i128, P>
pub fn recip(
self,
mode: RoundMode
) -> Result<FixedPoint<i128, P>, ArithmeticError>
i128
only.sourcepub fn cneg(self) -> Result<FixedPoint<i128, P>, ArithmeticError>
Available on crate feature i128
only.
pub fn cneg(self) -> Result<FixedPoint<i128, P>, ArithmeticError>
i128
only.Checked negation. Returns Err
on overflow (you can’t negate MIN
value).
pub fn half_sum(
a: FixedPoint<i128, P>,
b: FixedPoint<i128, P>,
mode: RoundMode
) -> FixedPoint<i128, P>
i128
only.sourcepub fn integral(self, mode: RoundMode) -> i128
Available on crate feature i128
only.
pub fn integral(self, mode: RoundMode) -> i128
i128
only.Takes rounded integral part of the number.
use fixnum::{FixedPoint, typenum::U9, ops::RoundMode::*};
type Amount = FixedPoint<i64, U9>;
let a: Amount = "8273.519".parse()?;
assert_eq!(a.integral(Floor), 8273);
assert_eq!(a.integral(Ceil), 8274);
let a: Amount = "-8273.519".parse()?;
assert_eq!(a.integral(Floor), -8274);
assert_eq!(a.integral(Ceil), -8273);
pub fn round_towards_zero_by(
self,
precision: FixedPoint<i128, P>
) -> FixedPoint<i128, P>
i128
only.pub fn next_power_of_ten(self) -> Result<FixedPoint<i128, P>, ArithmeticError>
i128
only.pub fn rounding_from_f64(
value: f64
) -> Result<FixedPoint<i128, P>, ArithmeticError>
Use TryFrom
instead
i128
and std
only.pub fn to_f64(self) -> f64
Use From
instead
i128
only.pub fn rounding_to_i64(self) -> i64
i128
only.pub fn abs(self) -> Result<Self, ArithmeticError>
i128
only.sourceimpl<P: Precision> FixedPoint<i128, P>
impl<P: Precision> FixedPoint<i128, P>
pub fn from_decimal(
mantissa: i128,
exponent: i32
) -> Result<FixedPoint<i128, P>, ConvertError>
i128
only.Trait Implementations
sourceimpl<P: Precision> Bounded for FixedPoint<i16, P>
Available on crate feature i16
only.
impl<P: Precision> Bounded for FixedPoint<i16, P>
i16
only.sourceimpl<P: Precision> Bounded for FixedPoint<i32, P>
Available on crate feature i32
only.
impl<P: Precision> Bounded for FixedPoint<i32, P>
i32
only.sourceimpl<P: Precision> Bounded for FixedPoint<i64, P>
Available on crate feature i64
only.
impl<P: Precision> Bounded for FixedPoint<i64, P>
i64
only.sourceimpl<P: Precision> Bounded for FixedPoint<i128, P>
Available on crate feature i128
only.
impl<P: Precision> Bounded for FixedPoint<i128, P>
i128
only.sourceimpl<P: Precision> CheckedAdd<FixedPoint<i128, P>> for FixedPoint<i128, P>
Available on crate feature i128
only.
impl<P: Precision> CheckedAdd<FixedPoint<i128, P>> for FixedPoint<i128, P>
i128
only.type Output = FixedPoint<i128, P>
type Error = ArithmeticError
sourcefn cadd(
self,
rhs: FixedPoint<i128, P>
) -> Result<FixedPoint<i128, P>, ArithmeticError>
fn cadd(
self,
rhs: FixedPoint<i128, P>
) -> Result<FixedPoint<i128, P>, ArithmeticError>
Checked addition. Returns Err
on overflow. Read more
sourceimpl<P: Precision> CheckedAdd<FixedPoint<i16, P>> for FixedPoint<i16, P>
Available on crate feature i16
only.
impl<P: Precision> CheckedAdd<FixedPoint<i16, P>> for FixedPoint<i16, P>
i16
only.type Output = FixedPoint<i16, P>
type Error = ArithmeticError
sourcefn cadd(
self,
rhs: FixedPoint<i16, P>
) -> Result<FixedPoint<i16, P>, ArithmeticError>
fn cadd(
self,
rhs: FixedPoint<i16, P>
) -> Result<FixedPoint<i16, P>, ArithmeticError>
Checked addition. Returns Err
on overflow. Read more
sourceimpl<P: Precision> CheckedAdd<FixedPoint<i32, P>> for FixedPoint<i32, P>
Available on crate feature i32
only.
impl<P: Precision> CheckedAdd<FixedPoint<i32, P>> for FixedPoint<i32, P>
i32
only.type Output = FixedPoint<i32, P>
type Error = ArithmeticError
sourcefn cadd(
self,
rhs: FixedPoint<i32, P>
) -> Result<FixedPoint<i32, P>, ArithmeticError>
fn cadd(
self,
rhs: FixedPoint<i32, P>
) -> Result<FixedPoint<i32, P>, ArithmeticError>
Checked addition. Returns Err
on overflow. Read more
sourceimpl<P: Precision> CheckedAdd<FixedPoint<i64, P>> for FixedPoint<i64, P>
Available on crate feature i64
only.
impl<P: Precision> CheckedAdd<FixedPoint<i64, P>> for FixedPoint<i64, P>
i64
only.type Output = FixedPoint<i64, P>
type Error = ArithmeticError
sourcefn cadd(
self,
rhs: FixedPoint<i64, P>
) -> Result<FixedPoint<i64, P>, ArithmeticError>
fn cadd(
self,
rhs: FixedPoint<i64, P>
) -> Result<FixedPoint<i64, P>, ArithmeticError>
Checked addition. Returns Err
on overflow. Read more
sourceimpl<P: Precision> CheckedMul<FixedPoint<i128, P>> for i128
Available on crate feature i128
only.
impl<P: Precision> CheckedMul<FixedPoint<i128, P>> for i128
i128
only.type Output = FixedPoint<i128, P>
type Error = ArithmeticError
sourcefn cmul(
self,
rhs: FixedPoint<i128, P>
) -> Result<FixedPoint<i128, P>, ArithmeticError>
fn cmul(
self,
rhs: FixedPoint<i128, P>
) -> Result<FixedPoint<i128, P>, ArithmeticError>
Checked multiplication. Returns Err
on overflow.
This is multiplication without rounding, hence it’s available only when at least one operand is integer. Read more
sourcefn saturating_mul(self, rhs: FixedPoint<i128, P>) -> Self::Output
fn saturating_mul(self, rhs: FixedPoint<i128, P>) -> Self::Output
sourceimpl<P: Precision> CheckedMul<FixedPoint<i16, P>> for i16
Available on crate feature i16
only.
impl<P: Precision> CheckedMul<FixedPoint<i16, P>> for i16
i16
only.type Output = FixedPoint<i16, P>
type Error = ArithmeticError
sourcefn cmul(
self,
rhs: FixedPoint<i16, P>
) -> Result<FixedPoint<i16, P>, ArithmeticError>
fn cmul(
self,
rhs: FixedPoint<i16, P>
) -> Result<FixedPoint<i16, P>, ArithmeticError>
Checked multiplication. Returns Err
on overflow.
This is multiplication without rounding, hence it’s available only when at least one operand is integer. Read more
sourcefn saturating_mul(self, rhs: FixedPoint<i16, P>) -> Self::Output
fn saturating_mul(self, rhs: FixedPoint<i16, P>) -> Self::Output
sourceimpl<P: Precision> CheckedMul<FixedPoint<i32, P>> for i32
Available on crate feature i32
only.
impl<P: Precision> CheckedMul<FixedPoint<i32, P>> for i32
i32
only.type Output = FixedPoint<i32, P>
type Error = ArithmeticError
sourcefn cmul(
self,
rhs: FixedPoint<i32, P>
) -> Result<FixedPoint<i32, P>, ArithmeticError>
fn cmul(
self,
rhs: FixedPoint<i32, P>
) -> Result<FixedPoint<i32, P>, ArithmeticError>
Checked multiplication. Returns Err
on overflow.
This is multiplication without rounding, hence it’s available only when at least one operand is integer. Read more
sourcefn saturating_mul(self, rhs: FixedPoint<i32, P>) -> Self::Output
fn saturating_mul(self, rhs: FixedPoint<i32, P>) -> Self::Output
sourceimpl<P: Precision> CheckedMul<FixedPoint<i64, P>> for i64
Available on crate feature i64
only.
impl<P: Precision> CheckedMul<FixedPoint<i64, P>> for i64
i64
only.type Output = FixedPoint<i64, P>
type Error = ArithmeticError
sourcefn cmul(
self,
rhs: FixedPoint<i64, P>
) -> Result<FixedPoint<i64, P>, ArithmeticError>
fn cmul(
self,
rhs: FixedPoint<i64, P>
) -> Result<FixedPoint<i64, P>, ArithmeticError>
Checked multiplication. Returns Err
on overflow.
This is multiplication without rounding, hence it’s available only when at least one operand is integer. Read more
sourcefn saturating_mul(self, rhs: FixedPoint<i64, P>) -> Self::Output
fn saturating_mul(self, rhs: FixedPoint<i64, P>) -> Self::Output
sourceimpl<P: Precision> CheckedMul<i128> for FixedPoint<i128, P>
Available on crate feature i128
only.
impl<P: Precision> CheckedMul<i128> for FixedPoint<i128, P>
i128
only.type Output = FixedPoint<i128, P>
type Error = ArithmeticError
sourcefn cmul(self, rhs: i128) -> Result<FixedPoint<i128, P>, ArithmeticError>
fn cmul(self, rhs: i128) -> Result<FixedPoint<i128, P>, ArithmeticError>
Checked multiplication. Returns Err
on overflow.
This is multiplication without rounding, hence it’s available only when at least one operand is integer. Read more
sourceimpl<P: Precision> CheckedMul<i16> for FixedPoint<i16, P>
Available on crate feature i16
only.
impl<P: Precision> CheckedMul<i16> for FixedPoint<i16, P>
i16
only.type Output = FixedPoint<i16, P>
type Error = ArithmeticError
sourcefn cmul(self, rhs: i16) -> Result<FixedPoint<i16, P>, ArithmeticError>
fn cmul(self, rhs: i16) -> Result<FixedPoint<i16, P>, ArithmeticError>
Checked multiplication. Returns Err
on overflow.
This is multiplication without rounding, hence it’s available only when at least one operand is integer. Read more
sourceimpl<P: Precision> CheckedMul<i32> for FixedPoint<i32, P>
Available on crate feature i32
only.
impl<P: Precision> CheckedMul<i32> for FixedPoint<i32, P>
i32
only.type Output = FixedPoint<i32, P>
type Error = ArithmeticError
sourcefn cmul(self, rhs: i32) -> Result<FixedPoint<i32, P>, ArithmeticError>
fn cmul(self, rhs: i32) -> Result<FixedPoint<i32, P>, ArithmeticError>
Checked multiplication. Returns Err
on overflow.
This is multiplication without rounding, hence it’s available only when at least one operand is integer. Read more
sourceimpl<P: Precision> CheckedMul<i64> for FixedPoint<i64, P>
Available on crate feature i64
only.
impl<P: Precision> CheckedMul<i64> for FixedPoint<i64, P>
i64
only.type Output = FixedPoint<i64, P>
type Error = ArithmeticError
sourcefn cmul(self, rhs: i64) -> Result<FixedPoint<i64, P>, ArithmeticError>
fn cmul(self, rhs: i64) -> Result<FixedPoint<i64, P>, ArithmeticError>
Checked multiplication. Returns Err
on overflow.
This is multiplication without rounding, hence it’s available only when at least one operand is integer. Read more
sourceimpl<P: Precision> CheckedSub<FixedPoint<i128, P>> for FixedPoint<i128, P>
Available on crate feature i128
only.
impl<P: Precision> CheckedSub<FixedPoint<i128, P>> for FixedPoint<i128, P>
i128
only.type Output = FixedPoint<i128, P>
type Error = ArithmeticError
sourcefn csub(
self,
rhs: FixedPoint<i128, P>
) -> Result<FixedPoint<i128, P>, ArithmeticError>
fn csub(
self,
rhs: FixedPoint<i128, P>
) -> Result<FixedPoint<i128, P>, ArithmeticError>
Checked subtraction. Returns Err
on overflow. Read more
sourceimpl<P: Precision> CheckedSub<FixedPoint<i16, P>> for FixedPoint<i16, P>
Available on crate feature i16
only.
impl<P: Precision> CheckedSub<FixedPoint<i16, P>> for FixedPoint<i16, P>
i16
only.type Output = FixedPoint<i16, P>
type Error = ArithmeticError
sourcefn csub(
self,
rhs: FixedPoint<i16, P>
) -> Result<FixedPoint<i16, P>, ArithmeticError>
fn csub(
self,
rhs: FixedPoint<i16, P>
) -> Result<FixedPoint<i16, P>, ArithmeticError>
Checked subtraction. Returns Err
on overflow. Read more
sourceimpl<P: Precision> CheckedSub<FixedPoint<i32, P>> for FixedPoint<i32, P>
Available on crate feature i32
only.
impl<P: Precision> CheckedSub<FixedPoint<i32, P>> for FixedPoint<i32, P>
i32
only.type Output = FixedPoint<i32, P>
type Error = ArithmeticError
sourcefn csub(
self,
rhs: FixedPoint<i32, P>
) -> Result<FixedPoint<i32, P>, ArithmeticError>
fn csub(
self,
rhs: FixedPoint<i32, P>
) -> Result<FixedPoint<i32, P>, ArithmeticError>
Checked subtraction. Returns Err
on overflow. Read more
sourceimpl<P: Precision> CheckedSub<FixedPoint<i64, P>> for FixedPoint<i64, P>
Available on crate feature i64
only.
impl<P: Precision> CheckedSub<FixedPoint<i64, P>> for FixedPoint<i64, P>
i64
only.type Output = FixedPoint<i64, P>
type Error = ArithmeticError
sourcefn csub(
self,
rhs: FixedPoint<i64, P>
) -> Result<FixedPoint<i64, P>, ArithmeticError>
fn csub(
self,
rhs: FixedPoint<i64, P>
) -> Result<FixedPoint<i64, P>, ArithmeticError>
Checked subtraction. Returns Err
on overflow. Read more
sourceimpl<I: Clone, P: Clone> Clone for FixedPoint<I, P>
impl<I: Clone, P: Clone> Clone for FixedPoint<I, P>
sourcefn clone(&self) -> FixedPoint<I, P>
fn clone(&self) -> FixedPoint<I, P>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<P> CompactAs for FixedPoint<i16, P>
Available on crate features parity
and i16
only.
impl<P> CompactAs for FixedPoint<i16, P>
parity
and i16
only.sourceimpl<P> CompactAs for FixedPoint<i32, P>
Available on crate features parity
and i32
only.
impl<P> CompactAs for FixedPoint<i32, P>
parity
and i32
only.sourceimpl<P> CompactAs for FixedPoint<i64, P>
Available on crate features parity
and i64
only.
impl<P> CompactAs for FixedPoint<i64, P>
parity
and i64
only.sourceimpl<P> CompactAs for FixedPoint<i128, P>
Available on crate features parity
and i128
only.
impl<P> CompactAs for FixedPoint<i128, P>
parity
and i128
only.sourceimpl<P: Precision> Debug for FixedPoint<i16, P>
Available on crate feature i16
only.
impl<P: Precision> Debug for FixedPoint<i16, P>
i16
only.sourceimpl<P: Precision> Debug for FixedPoint<i32, P>
Available on crate feature i32
only.
impl<P: Precision> Debug for FixedPoint<i32, P>
i32
only.sourceimpl<P: Precision> Debug for FixedPoint<i64, P>
Available on crate feature i64
only.
impl<P: Precision> Debug for FixedPoint<i64, P>
i64
only.sourceimpl<P: Precision> Debug for FixedPoint<i128, P>
Available on crate feature i128
only.
impl<P: Precision> Debug for FixedPoint<i128, P>
i128
only.sourceimpl<P> Decode for FixedPoint<i16, P>
Available on crate features parity
and i16
only.
impl<P> Decode for FixedPoint<i16, P>
parity
and i16
only.sourcefn decode<In: Input>(input: &mut In) -> Result<Self, Error>
fn decode<In: Input>(input: &mut In) -> Result<Self, Error>
Attempt to deserialise the value from input.
sourcefn skip<I>(input: &mut I) -> Result<(), Error> where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error> where
I: Input,
Attempt to skip the encoded value from input. Read more
sourcefn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
sourceimpl<P> Decode for FixedPoint<i32, P>
Available on crate features parity
and i32
only.
impl<P> Decode for FixedPoint<i32, P>
parity
and i32
only.sourcefn decode<In: Input>(input: &mut In) -> Result<Self, Error>
fn decode<In: Input>(input: &mut In) -> Result<Self, Error>
Attempt to deserialise the value from input.
sourcefn skip<I>(input: &mut I) -> Result<(), Error> where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error> where
I: Input,
Attempt to skip the encoded value from input. Read more
sourcefn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
sourceimpl<P> Decode for FixedPoint<i64, P>
Available on crate features parity
and i64
only.
impl<P> Decode for FixedPoint<i64, P>
parity
and i64
only.sourcefn decode<In: Input>(input: &mut In) -> Result<Self, Error>
fn decode<In: Input>(input: &mut In) -> Result<Self, Error>
Attempt to deserialise the value from input.
sourcefn skip<I>(input: &mut I) -> Result<(), Error> where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error> where
I: Input,
Attempt to skip the encoded value from input. Read more
sourcefn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
sourceimpl<P> Decode for FixedPoint<i128, P>
Available on crate features parity
and i128
only.
impl<P> Decode for FixedPoint<i128, P>
parity
and i128
only.sourcefn decode<In: Input>(input: &mut In) -> Result<Self, Error>
fn decode<In: Input>(input: &mut In) -> Result<Self, Error>
Attempt to deserialise the value from input.
sourcefn skip<I>(input: &mut I) -> Result<(), Error> where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error> where
I: Input,
Attempt to skip the encoded value from input. Read more
sourcefn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
sourceimpl<I: Default, P: Default> Default for FixedPoint<I, P>
impl<I: Default, P: Default> Default for FixedPoint<I, P>
sourcefn default() -> FixedPoint<I, P>
fn default() -> FixedPoint<I, P>
Returns the “default value” for a type. Read more
sourceimpl<'de, I, P> Deserialize<'de> for FixedPoint<I, P> where
I: Deserialize<'de>,
Self: FromStr,
Available on crate feature serde
only.
impl<'de, I, P> Deserialize<'de> for FixedPoint<I, P> where
I: Deserialize<'de>,
Self: FromStr,
serde
only.sourcefn 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
sourceimpl<P: Precision> Display for FixedPoint<i16, P>
Available on crate feature i16
only.
impl<P: Precision> Display for FixedPoint<i16, P>
i16
only.sourceimpl<P: Precision> Display for FixedPoint<i32, P>
Available on crate feature i32
only.
impl<P: Precision> Display for FixedPoint<i32, P>
i32
only.sourceimpl<P: Precision> Display for FixedPoint<i64, P>
Available on crate feature i64
only.
impl<P: Precision> Display for FixedPoint<i64, P>
i64
only.sourceimpl<P: Precision> Display for FixedPoint<i128, P>
Available on crate feature i128
only.
impl<P: Precision> Display for FixedPoint<i128, P>
i128
only.sourceimpl<P> Encode for FixedPoint<i16, P>
Available on crate features parity
and i16
only.
impl<P> Encode for FixedPoint<i16, P>
parity
and i16
only.sourcefn encode_to<O: Output + ?Sized>(&self, destination: &mut O)
fn encode_to<O: Output + ?Sized>(&self, destination: &mut O)
Convert self to a slice and append it to the destination.
sourcefn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
sourcefn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
fn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
Convert self to a slice and then invoke the given closure with it.
sourcefn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
sourceimpl<P> Encode for FixedPoint<i32, P>
Available on crate features parity
and i32
only.
impl<P> Encode for FixedPoint<i32, P>
parity
and i32
only.sourcefn encode_to<O: Output + ?Sized>(&self, destination: &mut O)
fn encode_to<O: Output + ?Sized>(&self, destination: &mut O)
Convert self to a slice and append it to the destination.
sourcefn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
sourcefn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
fn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
Convert self to a slice and then invoke the given closure with it.
sourcefn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
sourceimpl<P> Encode for FixedPoint<i64, P>
Available on crate features parity
and i64
only.
impl<P> Encode for FixedPoint<i64, P>
parity
and i64
only.sourcefn encode_to<O: Output + ?Sized>(&self, destination: &mut O)
fn encode_to<O: Output + ?Sized>(&self, destination: &mut O)
Convert self to a slice and append it to the destination.
sourcefn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
sourcefn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
fn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
Convert self to a slice and then invoke the given closure with it.
sourcefn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
sourceimpl<P> Encode for FixedPoint<i128, P>
Available on crate features parity
and i128
only.
impl<P> Encode for FixedPoint<i128, P>
parity
and i128
only.sourcefn encode_to<O: Output + ?Sized>(&self, destination: &mut O)
fn encode_to<O: Output + ?Sized>(&self, destination: &mut O)
Convert self to a slice and append it to the destination.
sourcefn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
sourcefn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
fn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
Convert self to a slice and then invoke the given closure with it.
sourcefn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
sourceimpl<I, P> From<Compact<FixedPoint<I, P>>> for FixedPoint<I, P>
Available on crate feature parity
only.
impl<I, P> From<Compact<FixedPoint<I, P>>> for FixedPoint<I, P>
parity
only.sourceimpl<P: Precision> From<FixedPoint<i128, P>> for f64
impl<P: Precision> From<FixedPoint<i128, P>> for f64
sourcefn from(value: FixedPoint<i128, P>) -> Self
fn from(value: FixedPoint<i128, P>) -> Self
Converts to this type from the input type.
sourceimpl<P: Precision> From<FixedPoint<i16, P>> for f64
impl<P: Precision> From<FixedPoint<i16, P>> for f64
sourcefn from(value: FixedPoint<i16, P>) -> Self
fn from(value: FixedPoint<i16, P>) -> Self
Converts to this type from the input type.
sourceimpl<P: Precision> From<FixedPoint<i32, P>> for f64
impl<P: Precision> From<FixedPoint<i32, P>> for f64
sourcefn from(value: FixedPoint<i32, P>) -> Self
fn from(value: FixedPoint<i32, P>) -> Self
Converts to this type from the input type.
sourceimpl<P: Precision> From<FixedPoint<i64, P>> for f64
impl<P: Precision> From<FixedPoint<i64, P>> for f64
sourcefn from(value: FixedPoint<i64, P>) -> Self
fn from(value: FixedPoint<i64, P>) -> Self
Converts to this type from the input type.
sourceimpl<P: Precision> FromStr for FixedPoint<i16, P>
impl<P: Precision> FromStr for FixedPoint<i16, P>
sourceimpl<P: Precision> FromStr for FixedPoint<i32, P>
impl<P: Precision> FromStr for FixedPoint<i32, P>
sourceimpl<P: Precision> FromStr for FixedPoint<i64, P>
impl<P: Precision> FromStr for FixedPoint<i64, P>
sourceimpl<P: Precision> FromStr for FixedPoint<i128, P>
impl<P: Precision> FromStr for FixedPoint<i128, P>
sourceimpl<I: Hash, P: Hash> Hash for FixedPoint<I, P>
impl<I: Hash, P: Hash> Hash for FixedPoint<I, P>
sourceimpl<P: Precision> One for FixedPoint<i16, P>
Available on crate feature i16
only.
impl<P: Precision> One for FixedPoint<i16, P>
i16
only.sourceimpl<P: Precision> One for FixedPoint<i32, P>
Available on crate feature i32
only.
impl<P: Precision> One for FixedPoint<i32, P>
i32
only.sourceimpl<P: Precision> One for FixedPoint<i64, P>
Available on crate feature i64
only.
impl<P: Precision> One for FixedPoint<i64, P>
i64
only.sourceimpl<P: Precision> One for FixedPoint<i128, P>
Available on crate feature i128
only.
impl<P: Precision> One for FixedPoint<i128, P>
i128
only.sourceimpl<I: Ord, P: Ord> Ord for FixedPoint<I, P>
impl<I: Ord, P: Ord> Ord for FixedPoint<I, P>
sourceimpl<I: PartialEq, P: PartialEq> PartialEq<FixedPoint<I, P>> for FixedPoint<I, P>
impl<I: PartialEq, P: PartialEq> PartialEq<FixedPoint<I, P>> for FixedPoint<I, P>
sourcefn eq(&self, other: &FixedPoint<I, P>) -> bool
fn eq(&self, other: &FixedPoint<I, P>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &FixedPoint<I, P>) -> bool
fn ne(&self, other: &FixedPoint<I, P>) -> bool
This method tests for !=
.
sourceimpl<I: PartialOrd, P: PartialOrd> PartialOrd<FixedPoint<I, P>> for FixedPoint<I, P>
impl<I: PartialOrd, P: PartialOrd> PartialOrd<FixedPoint<I, P>> for FixedPoint<I, P>
sourcefn partial_cmp(&self, other: &FixedPoint<I, P>) -> Option<Ordering>
fn partial_cmp(&self, other: &FixedPoint<I, P>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<P: Precision> RoundingDiv<FixedPoint<i128, P>> for FixedPoint<i128, P>
Available on crate feature i128
only.
impl<P: Precision> RoundingDiv<FixedPoint<i128, P>> for FixedPoint<i128, P>
i128
only.type Output = FixedPoint<i128, P>
type Error = ArithmeticError
sourcefn rdiv(self, rhs: Self, mode: RoundMode) -> Result<Self, ArithmeticError>
fn rdiv(self, rhs: Self, mode: RoundMode) -> Result<Self, ArithmeticError>
Checked rounded division. Returns Err
on overflow or attempt to divide by zero.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourceimpl<P: Precision> RoundingDiv<FixedPoint<i128, P>> for i128
Available on crate feature i128
only.
impl<P: Precision> RoundingDiv<FixedPoint<i128, P>> for i128
i128
only.type Output = FixedPoint<i128, P>
type Error = ArithmeticError
sourcefn rdiv(
self,
rhs: FixedPoint<i128, P>,
mode: RoundMode
) -> Result<FixedPoint<i128, P>, ArithmeticError>
fn rdiv(
self,
rhs: FixedPoint<i128, P>,
mode: RoundMode
) -> Result<FixedPoint<i128, P>, ArithmeticError>
Checked rounded division. Returns Err
on overflow or attempt to divide by zero.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourceimpl<P: Precision> RoundingDiv<FixedPoint<i16, P>> for FixedPoint<i16, P>
Available on crate feature i16
only.
impl<P: Precision> RoundingDiv<FixedPoint<i16, P>> for FixedPoint<i16, P>
i16
only.type Output = FixedPoint<i16, P>
type Error = ArithmeticError
sourcefn rdiv(self, rhs: Self, mode: RoundMode) -> Result<Self, ArithmeticError>
fn rdiv(self, rhs: Self, mode: RoundMode) -> Result<Self, ArithmeticError>
Checked rounded division. Returns Err
on overflow or attempt to divide by zero.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourceimpl<P: Precision> RoundingDiv<FixedPoint<i16, P>> for i16
Available on crate feature i16
only.
impl<P: Precision> RoundingDiv<FixedPoint<i16, P>> for i16
i16
only.type Output = FixedPoint<i16, P>
type Error = ArithmeticError
sourcefn rdiv(
self,
rhs: FixedPoint<i16, P>,
mode: RoundMode
) -> Result<FixedPoint<i16, P>, ArithmeticError>
fn rdiv(
self,
rhs: FixedPoint<i16, P>,
mode: RoundMode
) -> Result<FixedPoint<i16, P>, ArithmeticError>
Checked rounded division. Returns Err
on overflow or attempt to divide by zero.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourceimpl<P: Precision> RoundingDiv<FixedPoint<i32, P>> for FixedPoint<i32, P>
Available on crate feature i32
only.
impl<P: Precision> RoundingDiv<FixedPoint<i32, P>> for FixedPoint<i32, P>
i32
only.type Output = FixedPoint<i32, P>
type Error = ArithmeticError
sourcefn rdiv(self, rhs: Self, mode: RoundMode) -> Result<Self, ArithmeticError>
fn rdiv(self, rhs: Self, mode: RoundMode) -> Result<Self, ArithmeticError>
Checked rounded division. Returns Err
on overflow or attempt to divide by zero.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourceimpl<P: Precision> RoundingDiv<FixedPoint<i32, P>> for i32
Available on crate feature i32
only.
impl<P: Precision> RoundingDiv<FixedPoint<i32, P>> for i32
i32
only.type Output = FixedPoint<i32, P>
type Error = ArithmeticError
sourcefn rdiv(
self,
rhs: FixedPoint<i32, P>,
mode: RoundMode
) -> Result<FixedPoint<i32, P>, ArithmeticError>
fn rdiv(
self,
rhs: FixedPoint<i32, P>,
mode: RoundMode
) -> Result<FixedPoint<i32, P>, ArithmeticError>
Checked rounded division. Returns Err
on overflow or attempt to divide by zero.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourceimpl<P: Precision> RoundingDiv<FixedPoint<i64, P>> for FixedPoint<i64, P>
Available on crate feature i64
only.
impl<P: Precision> RoundingDiv<FixedPoint<i64, P>> for FixedPoint<i64, P>
i64
only.type Output = FixedPoint<i64, P>
type Error = ArithmeticError
sourcefn rdiv(self, rhs: Self, mode: RoundMode) -> Result<Self, ArithmeticError>
fn rdiv(self, rhs: Self, mode: RoundMode) -> Result<Self, ArithmeticError>
Checked rounded division. Returns Err
on overflow or attempt to divide by zero.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourceimpl<P: Precision> RoundingDiv<FixedPoint<i64, P>> for i64
Available on crate feature i64
only.
impl<P: Precision> RoundingDiv<FixedPoint<i64, P>> for i64
i64
only.type Output = FixedPoint<i64, P>
type Error = ArithmeticError
sourcefn rdiv(
self,
rhs: FixedPoint<i64, P>,
mode: RoundMode
) -> Result<FixedPoint<i64, P>, ArithmeticError>
fn rdiv(
self,
rhs: FixedPoint<i64, P>,
mode: RoundMode
) -> Result<FixedPoint<i64, P>, ArithmeticError>
Checked rounded division. Returns Err
on overflow or attempt to divide by zero.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourceimpl<P: Precision> RoundingDiv<i128> for FixedPoint<i128, P>
Available on crate feature i128
only.
impl<P: Precision> RoundingDiv<i128> for FixedPoint<i128, P>
i128
only.type Output = FixedPoint<i128, P>
type Error = ArithmeticError
sourcefn rdiv(
self,
rhs: i128,
mode: RoundMode
) -> Result<FixedPoint<i128, P>, ArithmeticError>
fn rdiv(
self,
rhs: i128,
mode: RoundMode
) -> Result<FixedPoint<i128, P>, ArithmeticError>
Checked rounded division. Returns Err
on overflow or attempt to divide by zero.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourceimpl<P: Precision> RoundingDiv<i16> for FixedPoint<i16, P>
Available on crate feature i16
only.
impl<P: Precision> RoundingDiv<i16> for FixedPoint<i16, P>
i16
only.type Output = FixedPoint<i16, P>
type Error = ArithmeticError
sourcefn rdiv(
self,
rhs: i16,
mode: RoundMode
) -> Result<FixedPoint<i16, P>, ArithmeticError>
fn rdiv(
self,
rhs: i16,
mode: RoundMode
) -> Result<FixedPoint<i16, P>, ArithmeticError>
Checked rounded division. Returns Err
on overflow or attempt to divide by zero.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourceimpl<P: Precision> RoundingDiv<i32> for FixedPoint<i32, P>
Available on crate feature i32
only.
impl<P: Precision> RoundingDiv<i32> for FixedPoint<i32, P>
i32
only.type Output = FixedPoint<i32, P>
type Error = ArithmeticError
sourcefn rdiv(
self,
rhs: i32,
mode: RoundMode
) -> Result<FixedPoint<i32, P>, ArithmeticError>
fn rdiv(
self,
rhs: i32,
mode: RoundMode
) -> Result<FixedPoint<i32, P>, ArithmeticError>
Checked rounded division. Returns Err
on overflow or attempt to divide by zero.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourceimpl<P: Precision> RoundingDiv<i64> for FixedPoint<i64, P>
Available on crate feature i64
only.
impl<P: Precision> RoundingDiv<i64> for FixedPoint<i64, P>
i64
only.type Output = FixedPoint<i64, P>
type Error = ArithmeticError
sourcefn rdiv(
self,
rhs: i64,
mode: RoundMode
) -> Result<FixedPoint<i64, P>, ArithmeticError>
fn rdiv(
self,
rhs: i64,
mode: RoundMode
) -> Result<FixedPoint<i64, P>, ArithmeticError>
Checked rounded division. Returns Err
on overflow or attempt to divide by zero.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourceimpl<P: Precision> RoundingMul<FixedPoint<i128, P>> for FixedPoint<i128, P>
Available on crate feature i128
only.
impl<P: Precision> RoundingMul<FixedPoint<i128, P>> for FixedPoint<i128, P>
i128
only.type Output = FixedPoint<i128, P>
type Error = ArithmeticError
sourcefn rmul(self, rhs: Self, mode: RoundMode) -> Result<Self, ArithmeticError>
fn rmul(self, rhs: Self, mode: RoundMode) -> Result<Self, ArithmeticError>
Checked rounded multiplication. Returns Err
on overflow.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourcefn saturating_rmul(self, rhs: Rhs, round_mode: RoundMode) -> Self::Output where
Self: PartialOrd + Zero + Sized,
Rhs: PartialOrd + Zero,
Self::Output: Bounded,
fn saturating_rmul(self, rhs: Rhs, round_mode: RoundMode) -> Self::Output where
Self: PartialOrd + Zero + Sized,
Rhs: PartialOrd + Zero,
Self::Output: Bounded,
Saturating rounding multiplication. Computes self * rhs
, saturating at the numeric bounds
(MIN
, MAX
) instead of overflowing.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourceimpl<P: Precision> RoundingMul<FixedPoint<i16, P>> for FixedPoint<i16, P>
Available on crate feature i16
only.
impl<P: Precision> RoundingMul<FixedPoint<i16, P>> for FixedPoint<i16, P>
i16
only.type Output = FixedPoint<i16, P>
type Error = ArithmeticError
sourcefn rmul(self, rhs: Self, mode: RoundMode) -> Result<Self, ArithmeticError>
fn rmul(self, rhs: Self, mode: RoundMode) -> Result<Self, ArithmeticError>
Checked rounded multiplication. Returns Err
on overflow.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourcefn saturating_rmul(self, rhs: Rhs, round_mode: RoundMode) -> Self::Output where
Self: PartialOrd + Zero + Sized,
Rhs: PartialOrd + Zero,
Self::Output: Bounded,
fn saturating_rmul(self, rhs: Rhs, round_mode: RoundMode) -> Self::Output where
Self: PartialOrd + Zero + Sized,
Rhs: PartialOrd + Zero,
Self::Output: Bounded,
Saturating rounding multiplication. Computes self * rhs
, saturating at the numeric bounds
(MIN
, MAX
) instead of overflowing.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourceimpl<P: Precision> RoundingMul<FixedPoint<i32, P>> for FixedPoint<i32, P>
Available on crate feature i32
only.
impl<P: Precision> RoundingMul<FixedPoint<i32, P>> for FixedPoint<i32, P>
i32
only.type Output = FixedPoint<i32, P>
type Error = ArithmeticError
sourcefn rmul(self, rhs: Self, mode: RoundMode) -> Result<Self, ArithmeticError>
fn rmul(self, rhs: Self, mode: RoundMode) -> Result<Self, ArithmeticError>
Checked rounded multiplication. Returns Err
on overflow.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourcefn saturating_rmul(self, rhs: Rhs, round_mode: RoundMode) -> Self::Output where
Self: PartialOrd + Zero + Sized,
Rhs: PartialOrd + Zero,
Self::Output: Bounded,
fn saturating_rmul(self, rhs: Rhs, round_mode: RoundMode) -> Self::Output where
Self: PartialOrd + Zero + Sized,
Rhs: PartialOrd + Zero,
Self::Output: Bounded,
Saturating rounding multiplication. Computes self * rhs
, saturating at the numeric bounds
(MIN
, MAX
) instead of overflowing.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourceimpl<P: Precision> RoundingMul<FixedPoint<i64, P>> for FixedPoint<i64, P>
Available on crate feature i64
only.
impl<P: Precision> RoundingMul<FixedPoint<i64, P>> for FixedPoint<i64, P>
i64
only.type Output = FixedPoint<i64, P>
type Error = ArithmeticError
sourcefn rmul(self, rhs: Self, mode: RoundMode) -> Result<Self, ArithmeticError>
fn rmul(self, rhs: Self, mode: RoundMode) -> Result<Self, ArithmeticError>
Checked rounded multiplication. Returns Err
on overflow.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourcefn saturating_rmul(self, rhs: Rhs, round_mode: RoundMode) -> Self::Output where
Self: PartialOrd + Zero + Sized,
Rhs: PartialOrd + Zero,
Self::Output: Bounded,
fn saturating_rmul(self, rhs: Rhs, round_mode: RoundMode) -> Self::Output where
Self: PartialOrd + Zero + Sized,
Rhs: PartialOrd + Zero,
Self::Output: Bounded,
Saturating rounding multiplication. Computes self * rhs
, saturating at the numeric bounds
(MIN
, MAX
) instead of overflowing.
Because of provided RoundMode
it’s possible to perform across the FixedPoint
values. Read more
sourceimpl<P: Precision> RoundingSqrt for FixedPoint<i16, P>
Available on crate feature i16
only.
impl<P: Precision> RoundingSqrt for FixedPoint<i16, P>
i16
only.sourceimpl<P: Precision> RoundingSqrt for FixedPoint<i32, P>
Available on crate feature i32
only.
impl<P: Precision> RoundingSqrt for FixedPoint<i32, P>
i32
only.sourceimpl<P: Precision> RoundingSqrt for FixedPoint<i64, P>
Available on crate feature i64
only.
impl<P: Precision> RoundingSqrt for FixedPoint<i64, P>
i64
only.sourceimpl<P: Precision> RoundingSqrt for FixedPoint<i128, P>
Available on crate feature i128
only.
impl<P: Precision> RoundingSqrt for FixedPoint<i128, P>
i128
only.sourceimpl<I, P> Serialize for FixedPoint<I, P> where
I: Serialize,
Self: Stringify,
Available on crate feature serde
only.
impl<I, P> Serialize for FixedPoint<I, P> where
I: Serialize,
Self: Stringify,
serde
only.sourceimpl<P: Precision> TryFrom<f64> for FixedPoint<i16, P>
impl<P: Precision> TryFrom<f64> for FixedPoint<i16, P>
sourcefn try_from(value: f64) -> Result<Self, Self::Error>
fn try_from(value: f64) -> Result<Self, Self::Error>
Implementation courtesy of rust_decimal
crate
type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
sourceimpl<P: Precision> TryFrom<f64> for FixedPoint<i32, P>
impl<P: Precision> TryFrom<f64> for FixedPoint<i32, P>
sourcefn try_from(value: f64) -> Result<Self, Self::Error>
fn try_from(value: f64) -> Result<Self, Self::Error>
Implementation courtesy of rust_decimal
crate
type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
sourceimpl<P: Precision> TryFrom<f64> for FixedPoint<i64, P>
impl<P: Precision> TryFrom<f64> for FixedPoint<i64, P>
sourcefn try_from(value: f64) -> Result<Self, Self::Error>
fn try_from(value: f64) -> Result<Self, Self::Error>
Implementation courtesy of rust_decimal
crate
type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
sourceimpl<P: Precision> TryFrom<f64> for FixedPoint<i128, P>
impl<P: Precision> TryFrom<f64> for FixedPoint<i128, P>
sourcefn try_from(value: f64) -> Result<Self, Self::Error>
fn try_from(value: f64) -> Result<Self, Self::Error>
Implementation courtesy of rust_decimal
crate
type Error = ConvertError
type Error = ConvertError
The type returned in the event of a conversion error.
sourceimpl<P: Precision> Zero for FixedPoint<i16, P>
Available on crate feature i16
only.
impl<P: Precision> Zero for FixedPoint<i16, P>
i16
only.sourceimpl<P: Precision> Zero for FixedPoint<i32, P>
Available on crate feature i32
only.
impl<P: Precision> Zero for FixedPoint<i32, P>
i32
only.sourceimpl<P: Precision> Zero for FixedPoint<i64, P>
Available on crate feature i64
only.
impl<P: Precision> Zero for FixedPoint<i64, P>
i64
only.sourceimpl<P: Precision> Zero for FixedPoint<i128, P>
Available on crate feature i128
only.
impl<P: Precision> Zero for FixedPoint<i128, P>
i128
only.impl<I: Copy, P: Copy> Copy for FixedPoint<I, P>
impl<P> EncodeLike<FixedPoint<i128, P>> for FixedPoint<i128, P>
parity
and i128
only.impl<P> EncodeLike<FixedPoint<i16, P>> for FixedPoint<i16, P>
parity
and i16
only.impl<P> EncodeLike<FixedPoint<i32, P>> for FixedPoint<i32, P>
parity
and i32
only.impl<P> EncodeLike<FixedPoint<i64, P>> for FixedPoint<i64, P>
parity
and i64
only.impl<I: Eq, P: Eq> Eq for FixedPoint<I, P>
impl<I, P> StructuralEq for FixedPoint<I, P>
impl<I, P> StructuralPartialEq for FixedPoint<I, P>
Auto Trait Implementations
impl<I, P> RefUnwindSafe for FixedPoint<I, P> where
I: RefUnwindSafe,
P: RefUnwindSafe,
impl<I, P> Send for FixedPoint<I, P> where
I: Send,
P: Send,
impl<I, P> Sync for FixedPoint<I, P> where
I: Sync,
P: Sync,
impl<I, P> Unpin for FixedPoint<I, P> where
I: Unpin,
P: Unpin,
impl<I, P> UnwindSafe for FixedPoint<I, P> where
I: UnwindSafe,
P: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> DecodeLimit for T where
T: Decode,
impl<T> DecodeLimit for T where
T: Decode,
sourceimpl<T> HasCompact for T where
T: 'static,
Compact<T>: for<'a> EncodeAsRef<'a, T>,
Compact<T>: Decode,
Compact<T>: From<T>,
Compact<T>: Into<T>,
impl<T> HasCompact for T where
T: 'static,
Compact<T>: for<'a> EncodeAsRef<'a, T>,
Compact<T>: Decode,
Compact<T>: From<T>,
Compact<T>: Into<T>,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more