Skip to main content

FixedPoint

Struct FixedPoint 

Source
pub struct FixedPoint<I, P> { /* private fields */ }
Available on crate features 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§

Source§

impl<P: Precision> FixedPoint<i16, P>

Source

pub fn from_str_exact(str: &str) -> Result<Self, ConvertError>

Parses a string slice into a fixed point. If the value cannot be represented then this will return an error.

Use the FromStr instance to parse with rounding.

Source§

impl<P: Precision> FixedPoint<i32, P>

Source

pub fn from_str_exact(str: &str) -> Result<Self, ConvertError>

Parses a string slice into a fixed point. If the value cannot be represented then this will return an error.

Use the FromStr instance to parse with rounding.

Source§

impl<P: Precision> FixedPoint<i64, P>

Source

pub fn from_str_exact(str: &str) -> Result<Self, ConvertError>

Parses a string slice into a fixed point. If the value cannot be represented then this will return an error.

Use the FromStr instance to parse with rounding.

Source§

impl<P: Precision> FixedPoint<i128, P>

Source

pub fn from_str_exact(str: &str) -> Result<Self, ConvertError>

Parses a string slice into a fixed point. If the value cannot be represented then this will return an error.

Use the FromStr instance to parse with rounding.

Source§

impl<I, P> FixedPoint<I, P>

Source

pub const fn from_bits(raw: I) -> Self

Creates from the raw representation. 1 here is equal to 1**-P

Source

pub const fn as_bits(&self) -> &I

Returns the raw representation.

Source

pub fn into_bits(self) -> I

Converts to the raw representation.

Source§

impl<P: Precision> FixedPoint<i16, P>

Source

pub const PRECISION: i32 = P::I32

Available on crate feature i16 only.

The number of digits in the fractional part.

Source

pub const EPSILON: Self

Available on crate feature i16 only.

The difference between 0.0 and the next larger representable number.

Source§

impl<P: Precision> FixedPoint<i16, P>

Source

pub fn signum(self) -> i16

Available on crate feature i16 only.

Returns a number representing sign of self.

  • 0 if the number is zero
  • 1 if the number is positive
  • -1 if the number is negative
Source

pub fn recip(self, mode: RoundMode) -> Result<Self, ArithmeticError>

Available on crate feature i16 only.

Returns 1/n.

Source

pub fn cneg(self) -> Result<Self, ArithmeticError>

Available on crate feature i16 only.

Checked negation. Returns Err on overflow (you can’t negate MIN value).

Source

pub fn half_sum(a: Self, b: Self, mode: RoundMode) -> Self

Available on crate feature i16 only.

Calculates (a + b) / 2.

Source

pub fn integral(self, mode: RoundMode) -> i16

Available on crate feature 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(Nearest), 8274);
assert_eq!(a.integral(Ceil), 8274);

let a: Amount = "-8273.519".parse()?;
assert_eq!(a.integral(Floor), -8274);
assert_eq!(a.integral(Nearest), -8274);
assert_eq!(a.integral(Ceil), -8273);
Source

pub fn floor(self) -> Self

Available on crate feature i16 only.

Returns the largest integer less than or equal to a number.

Source

pub fn ceil(self) -> Self

Available on crate feature i16 only.

Returns the smallest integer greater than or equal to a number.

Source

pub fn round(self) -> Self

Available on crate feature i16 only.

Returns the nearest integer to a number. Round half-way cases away from 0.0.

Source

pub fn round_towards_zero_by(self, precision: Self) -> Self

Available on crate feature i16 only.

Rounds towards zero by the provided precision.

Source

pub fn next_power_of_ten(self) -> Result<Self, ArithmeticError>

Available on crate feature i16 only.

Returns the next power of ten:

  • For positive: the smallest greater than or equal to a number.
  • For negative: the largest less than or equal to a number.
Source

pub fn abs(self) -> Result<Self, ArithmeticError>

Available on crate feature i16 only.

Returns the absolute value of a number.

Source

pub fn rsqrt(self, mode: RoundMode) -> Result<Self, ArithmeticError>

Available on crate feature i16 only.

Checked rounding square root. Returns Err for negative argument.

Square root of a non-negative F is a non-negative S such that:

  • Floor: S ≤ sqrt(F)
  • Ceil: S ≥ sqrt(F)
  • Nearest: Floor or Ceil, which one is closer to sqrt(F)
use fixnum::{ArithmeticError, FixedPoint, typenum::U9};
use fixnum::ops::{Zero, RoundMode::*};

type Amount = FixedPoint<i64, U9>;

let a: Amount = "81".parse()?;
let b: Amount = "2".parse()?;
let c: Amount = "-100".parse()?;
assert_eq!(a.rsqrt(Floor)?, "9".parse()?);
assert_eq!(b.rsqrt(Floor)?, "1.414213562".parse()?);
assert_eq!(b.rsqrt(Ceil)?, "1.414213563".parse()?);
assert_eq!(c.rsqrt(Floor), Err(ArithmeticError::DomainViolation));
Source§

impl<P: Precision> FixedPoint<i16, P>

Source

pub fn from_decimal(mantissa: i16, exponent: i32) -> Result<Self, ConvertError>

Available on crate feature i16 only.

Creates a new number from separate mantissa and exponent.

Source

pub fn to_decimal(&self, max_exponent: i32) -> (i16, i32)

Available on crate feature i16 only.

Returns a pair (mantissa, exponent) where exponent is in [-PRECISION, max_exponent].

Examples:

  • fp!(5.5).to_decimal(0) // => (55, -1)
  • fp!(5.5).to_decimal(-1) // => (55, -1)
  • fp!(5.5).to_decimal(-2) // => (550, -2)
  • fp!(50).to_decimal(0) // => (50, 0)
  • fp!(50).to_decimal(i32::MAX) // => (5, 1)
§Panics

If max_exponent is less than -PRECISION.

Source§

impl<P: Precision> FixedPoint<i32, P>

Source

pub const PRECISION: i32 = P::I32

Available on crate feature i32 only.

The number of digits in the fractional part.

Source

pub const EPSILON: Self

Available on crate feature i32 only.

The difference between 0.0 and the next larger representable number.

Source§

impl<P: Precision> FixedPoint<i32, P>

Source

pub fn signum(self) -> i32

Available on crate feature i32 only.

Returns a number representing sign of self.

  • 0 if the number is zero
  • 1 if the number is positive
  • -1 if the number is negative
Source

pub fn recip(self, mode: RoundMode) -> Result<Self, ArithmeticError>

Available on crate feature i32 only.

Returns 1/n.

Source

pub fn cneg(self) -> Result<Self, ArithmeticError>

Available on crate feature i32 only.

Checked negation. Returns Err on overflow (you can’t negate MIN value).

Source

pub fn half_sum(a: Self, b: Self, mode: RoundMode) -> Self

Available on crate feature i32 only.

Calculates (a + b) / 2.

Source

pub fn integral(self, mode: RoundMode) -> i32

Available on crate feature 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(Nearest), 8274);
assert_eq!(a.integral(Ceil), 8274);

let a: Amount = "-8273.519".parse()?;
assert_eq!(a.integral(Floor), -8274);
assert_eq!(a.integral(Nearest), -8274);
assert_eq!(a.integral(Ceil), -8273);
Source

pub fn floor(self) -> Self

Available on crate feature i32 only.

Returns the largest integer less than or equal to a number.

Source

pub fn ceil(self) -> Self

Available on crate feature i32 only.

Returns the smallest integer greater than or equal to a number.

Source

pub fn round(self) -> Self

Available on crate feature i32 only.

Returns the nearest integer to a number. Round half-way cases away from 0.0.

Source

pub fn round_towards_zero_by(self, precision: Self) -> Self

Available on crate feature i32 only.

Rounds towards zero by the provided precision.

Source

pub fn next_power_of_ten(self) -> Result<Self, ArithmeticError>

Available on crate feature i32 only.

Returns the next power of ten:

  • For positive: the smallest greater than or equal to a number.
  • For negative: the largest less than or equal to a number.
Source

pub fn abs(self) -> Result<Self, ArithmeticError>

Available on crate feature i32 only.

Returns the absolute value of a number.

Source

pub fn rsqrt(self, mode: RoundMode) -> Result<Self, ArithmeticError>

Available on crate feature i32 only.

Checked rounding square root. Returns Err for negative argument.

Square root of a non-negative F is a non-negative S such that:

  • Floor: S ≤ sqrt(F)
  • Ceil: S ≥ sqrt(F)
  • Nearest: Floor or Ceil, which one is closer to sqrt(F)
use fixnum::{ArithmeticError, FixedPoint, typenum::U9};
use fixnum::ops::{Zero, RoundMode::*};

type Amount = FixedPoint<i64, U9>;

let a: Amount = "81".parse()?;
let b: Amount = "2".parse()?;
let c: Amount = "-100".parse()?;
assert_eq!(a.rsqrt(Floor)?, "9".parse()?);
assert_eq!(b.rsqrt(Floor)?, "1.414213562".parse()?);
assert_eq!(b.rsqrt(Ceil)?, "1.414213563".parse()?);
assert_eq!(c.rsqrt(Floor), Err(ArithmeticError::DomainViolation));
Source§

impl<P: Precision> FixedPoint<i32, P>

Source

pub fn from_decimal(mantissa: i32, exponent: i32) -> Result<Self, ConvertError>

Available on crate feature i32 only.

Creates a new number from separate mantissa and exponent.

Source

pub fn to_decimal(&self, max_exponent: i32) -> (i32, i32)

Available on crate feature i32 only.

Returns a pair (mantissa, exponent) where exponent is in [-PRECISION, max_exponent].

Examples:

  • fp!(5.5).to_decimal(0) // => (55, -1)
  • fp!(5.5).to_decimal(-1) // => (55, -1)
  • fp!(5.5).to_decimal(-2) // => (550, -2)
  • fp!(50).to_decimal(0) // => (50, 0)
  • fp!(50).to_decimal(i32::MAX) // => (5, 1)
§Panics

If max_exponent is less than -PRECISION.

Source§

impl<P: Precision> FixedPoint<i64, P>

Source

pub const PRECISION: i32 = P::I32

Available on crate feature i64 only.

The number of digits in the fractional part.

Source

pub const EPSILON: Self

Available on crate feature i64 only.

The difference between 0.0 and the next larger representable number.

Source§

impl<P: Precision> FixedPoint<i64, P>

Source

pub fn signum(self) -> i64

Available on crate feature i64 only.

Returns a number representing sign of self.

  • 0 if the number is zero
  • 1 if the number is positive
  • -1 if the number is negative
Source

pub fn recip(self, mode: RoundMode) -> Result<Self, ArithmeticError>

Available on crate feature i64 only.

Returns 1/n.

Source

pub fn cneg(self) -> Result<Self, ArithmeticError>

Available on crate feature i64 only.

Checked negation. Returns Err on overflow (you can’t negate MIN value).

Source

pub fn half_sum(a: Self, b: Self, mode: RoundMode) -> Self

Available on crate feature i64 only.

Calculates (a + b) / 2.

Source

pub fn integral(self, mode: RoundMode) -> i64

Available on crate feature 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(Nearest), 8274);
assert_eq!(a.integral(Ceil), 8274);

let a: Amount = "-8273.519".parse()?;
assert_eq!(a.integral(Floor), -8274);
assert_eq!(a.integral(Nearest), -8274);
assert_eq!(a.integral(Ceil), -8273);
Source

pub fn floor(self) -> Self

Available on crate feature i64 only.

Returns the largest integer less than or equal to a number.

Source

pub fn ceil(self) -> Self

Available on crate feature i64 only.

Returns the smallest integer greater than or equal to a number.

Source

pub fn round(self) -> Self

Available on crate feature i64 only.

Returns the nearest integer to a number. Round half-way cases away from 0.0.

Source

pub fn round_towards_zero_by(self, precision: Self) -> Self

Available on crate feature i64 only.

Rounds towards zero by the provided precision.

Source

pub fn next_power_of_ten(self) -> Result<Self, ArithmeticError>

Available on crate feature i64 only.

Returns the next power of ten:

  • For positive: the smallest greater than or equal to a number.
  • For negative: the largest less than or equal to a number.
Source

pub fn abs(self) -> Result<Self, ArithmeticError>

Available on crate feature i64 only.

Returns the absolute value of a number.

Source

pub fn rsqrt(self, mode: RoundMode) -> Result<Self, ArithmeticError>

Available on crate feature i64 only.

Checked rounding square root. Returns Err for negative argument.

Square root of a non-negative F is a non-negative S such that:

  • Floor: S ≤ sqrt(F)
  • Ceil: S ≥ sqrt(F)
  • Nearest: Floor or Ceil, which one is closer to sqrt(F)
use fixnum::{ArithmeticError, FixedPoint, typenum::U9};
use fixnum::ops::{Zero, RoundMode::*};

type Amount = FixedPoint<i64, U9>;

let a: Amount = "81".parse()?;
let b: Amount = "2".parse()?;
let c: Amount = "-100".parse()?;
assert_eq!(a.rsqrt(Floor)?, "9".parse()?);
assert_eq!(b.rsqrt(Floor)?, "1.414213562".parse()?);
assert_eq!(b.rsqrt(Ceil)?, "1.414213563".parse()?);
assert_eq!(c.rsqrt(Floor), Err(ArithmeticError::DomainViolation));
Source§

impl<P: Precision> FixedPoint<i64, P>

Source

pub fn from_decimal(mantissa: i64, exponent: i32) -> Result<Self, ConvertError>

Available on crate feature i64 only.

Creates a new number from separate mantissa and exponent.

Source

pub fn to_decimal(&self, max_exponent: i32) -> (i64, i32)

Available on crate feature i64 only.

Returns a pair (mantissa, exponent) where exponent is in [-PRECISION, max_exponent].

Examples:

  • fp!(5.5).to_decimal(0) // => (55, -1)
  • fp!(5.5).to_decimal(-1) // => (55, -1)
  • fp!(5.5).to_decimal(-2) // => (550, -2)
  • fp!(50).to_decimal(0) // => (50, 0)
  • fp!(50).to_decimal(i32::MAX) // => (5, 1)
§Panics

If max_exponent is less than -PRECISION.

Source§

impl<P: Precision> FixedPoint<i128, P>

Source

pub const PRECISION: i32 = P::I32

Available on crate feature i128 only.

The number of digits in the fractional part.

Source

pub const EPSILON: Self

Available on crate feature i128 only.

The difference between 0.0 and the next larger representable number.

Source§

impl<P: Precision> FixedPoint<i128, P>

Source

pub fn signum(self) -> i128

Available on crate feature i128 only.

Returns a number representing sign of self.

  • 0 if the number is zero
  • 1 if the number is positive
  • -1 if the number is negative
Source

pub fn recip(self, mode: RoundMode) -> Result<Self, ArithmeticError>

Available on crate feature i128 only.

Returns 1/n.

Source

pub fn cneg(self) -> Result<Self, ArithmeticError>

Available on crate feature i128 only.

Checked negation. Returns Err on overflow (you can’t negate MIN value).

Source

pub fn half_sum(a: Self, b: Self, mode: RoundMode) -> Self

Available on crate feature i128 only.

Calculates (a + b) / 2.

Source

pub fn integral(self, mode: RoundMode) -> i128

Available on crate feature 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(Nearest), 8274);
assert_eq!(a.integral(Ceil), 8274);

let a: Amount = "-8273.519".parse()?;
assert_eq!(a.integral(Floor), -8274);
assert_eq!(a.integral(Nearest), -8274);
assert_eq!(a.integral(Ceil), -8273);
Source

pub fn floor(self) -> Self

Available on crate feature i128 only.

Returns the largest integer less than or equal to a number.

Source

pub fn ceil(self) -> Self

Available on crate feature i128 only.

Returns the smallest integer greater than or equal to a number.

Source

pub fn round(self) -> Self

Available on crate feature i128 only.

Returns the nearest integer to a number. Round half-way cases away from 0.0.

Source

pub fn round_towards_zero_by(self, precision: Self) -> Self

Available on crate feature i128 only.

Rounds towards zero by the provided precision.

Source

pub fn next_power_of_ten(self) -> Result<Self, ArithmeticError>

Available on crate feature i128 only.

Returns the next power of ten:

  • For positive: the smallest greater than or equal to a number.
  • For negative: the largest less than or equal to a number.
Source

pub fn abs(self) -> Result<Self, ArithmeticError>

Available on crate feature i128 only.

Returns the absolute value of a number.

Source

pub fn rsqrt(self, mode: RoundMode) -> Result<Self, ArithmeticError>

Available on crate feature i128 only.

Checked rounding square root. Returns Err for negative argument.

Square root of a non-negative F is a non-negative S such that:

  • Floor: S ≤ sqrt(F)
  • Ceil: S ≥ sqrt(F)
  • Nearest: Floor or Ceil, which one is closer to sqrt(F)
use fixnum::{ArithmeticError, FixedPoint, typenum::U9};
use fixnum::ops::{Zero, RoundMode::*};

type Amount = FixedPoint<i64, U9>;

let a: Amount = "81".parse()?;
let b: Amount = "2".parse()?;
let c: Amount = "-100".parse()?;
assert_eq!(a.rsqrt(Floor)?, "9".parse()?);
assert_eq!(b.rsqrt(Floor)?, "1.414213562".parse()?);
assert_eq!(b.rsqrt(Ceil)?, "1.414213563".parse()?);
assert_eq!(c.rsqrt(Floor), Err(ArithmeticError::DomainViolation));
Source§

impl<P: Precision> FixedPoint<i128, P>

Source

pub fn from_decimal(mantissa: i128, exponent: i32) -> Result<Self, ConvertError>

Available on crate feature i128 only.

Creates a new number from separate mantissa and exponent.

Source

pub fn to_decimal(&self, max_exponent: i32) -> (i128, i32)

Available on crate feature i128 only.

Returns a pair (mantissa, exponent) where exponent is in [-PRECISION, max_exponent].

Examples:

  • fp!(5.5).to_decimal(0) // => (55, -1)
  • fp!(5.5).to_decimal(-1) // => (55, -1)
  • fp!(5.5).to_decimal(-2) // => (550, -2)
  • fp!(50).to_decimal(0) // => (50, 0)
  • fp!(50).to_decimal(i32::MAX) // => (5, 1)
§Panics

If max_exponent is less than -PRECISION.

Trait Implementations§

Source§

impl<I, P> Archive for FixedPoint<I, P>
where I: Archive, PhantomData<P>: Archive,

Source§

type Archived = ArchivedFixedPoint<I, P>

The archived representation of this type. Read more
Source§

type Resolver = FixedPointResolver<I, P>

The resolver for this type. It must contain all the additional information from serializing needed to make the archived type from the normal type.
Source§

fn resolve(&self, resolver: Self::Resolver, out: Place<Self::Archived>)

Creates the archived version of this value at the given position and writes it to the given output. Read more
Source§

const COPY_OPTIMIZATION: CopyOptimization<Self> = _

An optimization flag that allows the bytes of this type to be copied directly to a writer instead of calling serialize. Read more
Source§

impl<P: Precision> Bounded for FixedPoint<i128, P>

Available on crate feature i128 only.
Source§

const MIN: Self

Represents MIN.
Source§

const MAX: Self

Represents MAX.
Source§

impl<P: Precision> Bounded for FixedPoint<i16, P>

Available on crate feature i16 only.
Source§

const MIN: Self

Represents MIN.
Source§

const MAX: Self

Represents MAX.
Source§

impl<P: Precision> Bounded for FixedPoint<i32, P>

Available on crate feature i32 only.
Source§

const MIN: Self

Represents MIN.
Source§

const MAX: Self

Represents MAX.
Source§

impl<P: Precision> Bounded for FixedPoint<i64, P>

Available on crate feature i64 only.
Source§

const MIN: Self

Represents MIN.
Source§

const MAX: Self

Represents MAX.
Source§

impl<P: Precision> CheckedAdd for FixedPoint<i128, P>

Available on crate feature i128 only.
Source§

type Output = FixedPoint<i128, P>

Result of addition.
Source§

type Error = ArithmeticError

Source§

fn cadd(self, rhs: Self) -> Result<Self, ArithmeticError>

Checked addition. Returns Err on overflow. Read more
Source§

fn saturating_add(self, rhs: Self) -> Self::Output

Saturating addition. Computes self + rhs, saturating at the numeric bounds (MIN, MAX) instead of overflowing. Read more
Source§

impl<P: Precision> CheckedAdd for FixedPoint<i16, P>

Available on crate feature i16 only.
Source§

type Output = FixedPoint<i16, P>

Result of addition.
Source§

type Error = ArithmeticError

Source§

fn cadd(self, rhs: Self) -> Result<Self, ArithmeticError>

Checked addition. Returns Err on overflow. Read more
Source§

fn saturating_add(self, rhs: Self) -> Self::Output

Saturating addition. Computes self + rhs, saturating at the numeric bounds (MIN, MAX) instead of overflowing. Read more
Source§

impl<P: Precision> CheckedAdd for FixedPoint<i32, P>

Available on crate feature i32 only.
Source§

type Output = FixedPoint<i32, P>

Result of addition.
Source§

type Error = ArithmeticError

Source§

fn cadd(self, rhs: Self) -> Result<Self, ArithmeticError>

Checked addition. Returns Err on overflow. Read more
Source§

fn saturating_add(self, rhs: Self) -> Self::Output

Saturating addition. Computes self + rhs, saturating at the numeric bounds (MIN, MAX) instead of overflowing. Read more
Source§

impl<P: Precision> CheckedAdd for FixedPoint<i64, P>

Available on crate feature i64 only.
Source§

type Output = FixedPoint<i64, P>

Result of addition.
Source§

type Error = ArithmeticError

Source§

fn cadd(self, rhs: Self) -> Result<Self, ArithmeticError>

Checked addition. Returns Err on overflow. Read more
Source§

fn saturating_add(self, rhs: Self) -> Self::Output

Saturating addition. Computes self + rhs, saturating at the numeric bounds (MIN, MAX) instead of overflowing. Read more
Source§

impl<P: Precision> CheckedMul<FixedPoint<i128, P>> for i128

Available on crate feature i128 only.
Source§

type Output = FixedPoint<i128, P>

Result of multiplication.
Source§

type Error = ArithmeticError

Source§

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
Source§

fn saturating_mul(self, rhs: FixedPoint<i128, P>) -> Self::Output

Saturating multiplication. Computes self * rhs, saturating at the numeric bounds (MIN, MAX) instead of overflowing. This is multiplication without rounding, hence it’s available only when at least one operand is integer. Read more
Source§

impl<P: Precision> CheckedMul<FixedPoint<i16, P>> for i16

Available on crate feature i16 only.
Source§

type Output = FixedPoint<i16, P>

Result of multiplication.
Source§

type Error = ArithmeticError

Source§

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
Source§

fn saturating_mul(self, rhs: FixedPoint<i16, P>) -> Self::Output

Saturating multiplication. Computes self * rhs, saturating at the numeric bounds (MIN, MAX) instead of overflowing. This is multiplication without rounding, hence it’s available only when at least one operand is integer. Read more
Source§

impl<P: Precision> CheckedMul<FixedPoint<i32, P>> for i32

Available on crate feature i32 only.
Source§

type Output = FixedPoint<i32, P>

Result of multiplication.
Source§

type Error = ArithmeticError

Source§

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
Source§

fn saturating_mul(self, rhs: FixedPoint<i32, P>) -> Self::Output

Saturating multiplication. Computes self * rhs, saturating at the numeric bounds (MIN, MAX) instead of overflowing. This is multiplication without rounding, hence it’s available only when at least one operand is integer. Read more
Source§

impl<P: Precision> CheckedMul<FixedPoint<i64, P>> for i64

Available on crate feature i64 only.
Source§

type Output = FixedPoint<i64, P>

Result of multiplication.
Source§

type Error = ArithmeticError

Source§

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
Source§

fn saturating_mul(self, rhs: FixedPoint<i64, P>) -> Self::Output

Saturating multiplication. Computes self * rhs, saturating at the numeric bounds (MIN, MAX) instead of overflowing. This is multiplication without rounding, hence it’s available only when at least one operand is integer. Read more
Source§

impl<P: Precision> CheckedMul<i128> for FixedPoint<i128, P>

Available on crate feature i128 only.
Source§

type Output = FixedPoint<i128, P>

Result of multiplication.
Source§

type Error = ArithmeticError

Source§

fn cmul(self, rhs: i128) -> Result<Self, 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
Source§

fn saturating_mul(self, rhs: i128) -> Self::Output

Saturating multiplication. Computes self * rhs, saturating at the numeric bounds (MIN, MAX) instead of overflowing. This is multiplication without rounding, hence it’s available only when at least one operand is integer. Read more
Source§

impl<P: Precision> CheckedMul<i16> for FixedPoint<i16, P>

Available on crate feature i16 only.
Source§

type Output = FixedPoint<i16, P>

Result of multiplication.
Source§

type Error = ArithmeticError

Source§

fn cmul(self, rhs: i16) -> Result<Self, 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
Source§

fn saturating_mul(self, rhs: i16) -> Self::Output

Saturating multiplication. Computes self * rhs, saturating at the numeric bounds (MIN, MAX) instead of overflowing. This is multiplication without rounding, hence it’s available only when at least one operand is integer. Read more
Source§

impl<P: Precision> CheckedMul<i32> for FixedPoint<i32, P>

Available on crate feature i32 only.
Source§

type Output = FixedPoint<i32, P>

Result of multiplication.
Source§

type Error = ArithmeticError

Source§

fn cmul(self, rhs: i32) -> Result<Self, 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
Source§

fn saturating_mul(self, rhs: i32) -> Self::Output

Saturating multiplication. Computes self * rhs, saturating at the numeric bounds (MIN, MAX) instead of overflowing. This is multiplication without rounding, hence it’s available only when at least one operand is integer. Read more
Source§

impl<P: Precision> CheckedMul<i64> for FixedPoint<i64, P>

Available on crate feature i64 only.
Source§

type Output = FixedPoint<i64, P>

Result of multiplication.
Source§

type Error = ArithmeticError

Source§

fn cmul(self, rhs: i64) -> Result<Self, 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
Source§

fn saturating_mul(self, rhs: i64) -> Self::Output

Saturating multiplication. Computes self * rhs, saturating at the numeric bounds (MIN, MAX) instead of overflowing. This is multiplication without rounding, hence it’s available only when at least one operand is integer. Read more
Source§

impl<P: Precision> CheckedSub for FixedPoint<i128, P>

Available on crate feature i128 only.
Source§

type Output = FixedPoint<i128, P>

Result of subtraction.
Source§

type Error = ArithmeticError

Source§

fn csub(self, rhs: Self) -> Result<Self, ArithmeticError>

Checked subtraction. Returns Err on overflow. Read more
Source§

fn saturating_sub(self, rhs: Self) -> Self::Output

Saturating subtraction. Computes self - rhs, saturating at the numeric bounds (MIN, MAX) instead of overflowing. Read more
Source§

impl<P: Precision> CheckedSub for FixedPoint<i16, P>

Available on crate feature i16 only.
Source§

type Output = FixedPoint<i16, P>

Result of subtraction.
Source§

type Error = ArithmeticError

Source§

fn csub(self, rhs: Self) -> Result<Self, ArithmeticError>

Checked subtraction. Returns Err on overflow. Read more
Source§

fn saturating_sub(self, rhs: Self) -> Self::Output

Saturating subtraction. Computes self - rhs, saturating at the numeric bounds (MIN, MAX) instead of overflowing. Read more
Source§

impl<P: Precision> CheckedSub for FixedPoint<i32, P>

Available on crate feature i32 only.
Source§

type Output = FixedPoint<i32, P>

Result of subtraction.
Source§

type Error = ArithmeticError

Source§

fn csub(self, rhs: Self) -> Result<Self, ArithmeticError>

Checked subtraction. Returns Err on overflow. Read more
Source§

fn saturating_sub(self, rhs: Self) -> Self::Output

Saturating subtraction. Computes self - rhs, saturating at the numeric bounds (MIN, MAX) instead of overflowing. Read more
Source§

impl<P: Precision> CheckedSub for FixedPoint<i64, P>

Available on crate feature i64 only.
Source§

type Output = FixedPoint<i64, P>

Result of subtraction.
Source§

type Error = ArithmeticError

Source§

fn csub(self, rhs: Self) -> Result<Self, ArithmeticError>

Checked subtraction. Returns Err on overflow. Read more
Source§

fn saturating_sub(self, rhs: Self) -> Self::Output

Saturating subtraction. Computes self - rhs, saturating at the numeric bounds (MIN, MAX) instead of overflowing. Read more
Source§

impl<I: Clone, P: Clone> Clone for FixedPoint<I, P>

Source§

fn clone(&self) -> FixedPoint<I, P>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P> CompactAs for FixedPoint<i128, P>

Available on crate features parity and i128 only.
Source§

type As = u128

A compact-encodable type that should be used as the encoding.
Source§

fn encode_as(&self) -> &Self::As

Returns the compact-encodable type.
Source§

fn decode_from(value: Self::As) -> Result<Self, Error>

Decode Self from the compact-decoded type.
Source§

impl<P> CompactAs for FixedPoint<i16, P>

Available on crate features parity and i16 only.
Source§

type As = u16

A compact-encodable type that should be used as the encoding.
Source§

fn encode_as(&self) -> &Self::As

Returns the compact-encodable type.
Source§

fn decode_from(value: Self::As) -> Result<Self, Error>

Decode Self from the compact-decoded type.
Source§

impl<P> CompactAs for FixedPoint<i32, P>

Available on crate features parity and i32 only.
Source§

type As = u32

A compact-encodable type that should be used as the encoding.
Source§

fn encode_as(&self) -> &Self::As

Returns the compact-encodable type.
Source§

fn decode_from(value: Self::As) -> Result<Self, Error>

Decode Self from the compact-decoded type.
Source§

impl<P> CompactAs for FixedPoint<i64, P>

Available on crate features parity and i64 only.
Source§

type As = u64

A compact-encodable type that should be used as the encoding.
Source§

fn encode_as(&self) -> &Self::As

Returns the compact-encodable type.
Source§

fn decode_from(value: Self::As) -> Result<Self, Error>

Decode Self from the compact-decoded type.
Source§

impl<P: Precision> Debug for FixedPoint<i128, P>

Available on crate feature i128 only.
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: Precision> Debug for FixedPoint<i16, P>

Available on crate feature i16 only.
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: Precision> Debug for FixedPoint<i32, P>

Available on crate feature i32 only.
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: Precision> Debug for FixedPoint<i64, P>

Available on crate feature i64 only.
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P> Decode for FixedPoint<i128, P>

Available on crate features parity and i128 only.
Source§

fn decode<In: Input>(input: &mut In) -> Result<Self, Error>

Attempt to deserialise the value from input.
Source§

fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self>, ) -> Result<DecodeFinished, Error>
where I: Input,

Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input,

Attempt to skip the encoded value from input. Read more
Source§

fn encoded_fixed_size() -> Option<usize>

Returns the fixed encoded size of the type. Read more
Source§

impl<P> Decode for FixedPoint<i16, P>

Available on crate features parity and i16 only.
Source§

fn decode<In: Input>(input: &mut In) -> Result<Self, Error>

Attempt to deserialise the value from input.
Source§

fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self>, ) -> Result<DecodeFinished, Error>
where I: Input,

Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input,

Attempt to skip the encoded value from input. Read more
Source§

fn encoded_fixed_size() -> Option<usize>

Returns the fixed encoded size of the type. Read more
Source§

impl<P> Decode for FixedPoint<i32, P>

Available on crate features parity and i32 only.
Source§

fn decode<In: Input>(input: &mut In) -> Result<Self, Error>

Attempt to deserialise the value from input.
Source§

fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self>, ) -> Result<DecodeFinished, Error>
where I: Input,

Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input,

Attempt to skip the encoded value from input. Read more
Source§

fn encoded_fixed_size() -> Option<usize>

Returns the fixed encoded size of the type. Read more
Source§

impl<P> Decode for FixedPoint<i64, P>

Available on crate features parity and i64 only.
Source§

fn decode<In: Input>(input: &mut In) -> Result<Self, Error>

Attempt to deserialise the value from input.
Source§

fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self>, ) -> Result<DecodeFinished, Error>
where I: Input,

Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input,

Attempt to skip the encoded value from input. Read more
Source§

fn encoded_fixed_size() -> Option<usize>

Returns the fixed encoded size of the type. Read more
Source§

impl<I: Default, P: Default> Default for FixedPoint<I, P>

Source§

fn default() -> FixedPoint<I, P>

Returns the “default value” for a type. Read more
Source§

impl<'de, I, P> Deserialize<'de> for FixedPoint<I, P>
where I: Deserialize<'de>, Self: FromStr + TryFrom<f64> + TryFrom<u64> + TryFrom<i64> + TryFrom<i128> + TryFrom<u128>,

Available on crate feature serde only.
Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<__D: Fallible + ?Sized, I, P> Deserialize<FixedPoint<I, P>, __D> for Archived<FixedPoint<I, P>>

Source§

fn deserialize( &self, deserializer: &mut __D, ) -> Result<FixedPoint<I, P>, <__D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl<P: Precision> Display for FixedPoint<i128, P>

Available on crate feature i128 only.
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: Precision> Display for FixedPoint<i16, P>

Available on crate feature i16 only.
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: Precision> Display for FixedPoint<i32, P>

Available on crate feature i32 only.
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: Precision> Display for FixedPoint<i64, P>

Available on crate feature i64 only.
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P> Encode for FixedPoint<i128, P>

Available on crate features parity and i128 only.
Source§

fn encode_to<O: Output + ?Sized>(&self, destination: &mut O)

Convert self to a slice and append it to the destination.
Source§

fn size_hint(&self) -> usize

If possible give a hint of expected size of the encoding. Read more
Source§

fn encode(&self) -> Vec<u8>

Convert self to an owned vector.
Source§

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.
Source§

fn encoded_size(&self) -> usize

Calculates the encoded size. Read more
Source§

impl<P> Encode for FixedPoint<i16, P>

Available on crate features parity and i16 only.
Source§

fn encode_to<O: Output + ?Sized>(&self, destination: &mut O)

Convert self to a slice and append it to the destination.
Source§

fn size_hint(&self) -> usize

If possible give a hint of expected size of the encoding. Read more
Source§

fn encode(&self) -> Vec<u8>

Convert self to an owned vector.
Source§

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.
Source§

fn encoded_size(&self) -> usize

Calculates the encoded size. Read more
Source§

impl<P> Encode for FixedPoint<i32, P>

Available on crate features parity and i32 only.
Source§

fn encode_to<O: Output + ?Sized>(&self, destination: &mut O)

Convert self to a slice and append it to the destination.
Source§

fn size_hint(&self) -> usize

If possible give a hint of expected size of the encoding. Read more
Source§

fn encode(&self) -> Vec<u8>

Convert self to an owned vector.
Source§

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.
Source§

fn encoded_size(&self) -> usize

Calculates the encoded size. Read more
Source§

impl<P> Encode for FixedPoint<i64, P>

Available on crate features parity and i64 only.
Source§

fn encode_to<O: Output + ?Sized>(&self, destination: &mut O)

Convert self to a slice and append it to the destination.
Source§

fn size_hint(&self) -> usize

If possible give a hint of expected size of the encoding. Read more
Source§

fn encode(&self) -> Vec<u8>

Convert self to an owned vector.
Source§

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.
Source§

fn encoded_size(&self) -> usize

Calculates the encoded size. Read more
Source§

impl<I, P> From<Compact<FixedPoint<I, P>>> for FixedPoint<I, P>

Available on crate feature parity only.
Source§

fn from(value: Compact<Self>) -> Self

Converts to this type from the input type.
Source§

impl<P: Precision> From<FixedPoint<i128, P>> for f64

Source§

fn from(value: FixedPoint<i128, P>) -> Self

Converts to this type from the input type.
Source§

impl<P: Precision> From<FixedPoint<i16, P>> for f64

Source§

fn from(value: FixedPoint<i16, P>) -> Self

Converts to this type from the input type.
Source§

impl<P: Precision> From<FixedPoint<i32, P>> for f64

Source§

fn from(value: FixedPoint<i32, P>) -> Self

Converts to this type from the input type.
Source§

impl<P: Precision> From<FixedPoint<i64, P>> for f64

Source§

fn from(value: FixedPoint<i64, P>) -> Self

Converts to this type from the input type.
Source§

impl<P: Precision> FromStr for FixedPoint<i128, P>

Source§

fn from_str(str: &str) -> Result<Self, Self::Err>

Parses a string slice into a fixed point. If the value cannot be represented, it will be rounded to the nearest value.

Use from_str_exact to parse without rounding.

Source§

type Err = ConvertError

The associated error which can be returned from parsing.
Source§

impl<P: Precision> FromStr for FixedPoint<i16, P>

Source§

fn from_str(str: &str) -> Result<Self, Self::Err>

Parses a string slice into a fixed point. If the value cannot be represented, it will be rounded to the nearest value.

Use from_str_exact to parse without rounding.

Source§

type Err = ConvertError

The associated error which can be returned from parsing.
Source§

impl<P: Precision> FromStr for FixedPoint<i32, P>

Source§

fn from_str(str: &str) -> Result<Self, Self::Err>

Parses a string slice into a fixed point. If the value cannot be represented, it will be rounded to the nearest value.

Use from_str_exact to parse without rounding.

Source§

type Err = ConvertError

The associated error which can be returned from parsing.
Source§

impl<P: Precision> FromStr for FixedPoint<i64, P>

Source§

fn from_str(str: &str) -> Result<Self, Self::Err>

Parses a string slice into a fixed point. If the value cannot be represented, it will be rounded to the nearest value.

Use from_str_exact to parse without rounding.

Source§

type Err = ConvertError

The associated error which can be returned from parsing.
Source§

impl<I: Hash, P: Hash> Hash for FixedPoint<I, P>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<I, P> JsonSchema for FixedPoint<I, P>

Available on crate feature schemars only.
Source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn json_schema(_: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

impl<P: Precision> One for FixedPoint<i128, P>

Available on crate feature i128 only.
Source§

const ONE: Self

Represents 1.
Source§

impl<P: Precision> One for FixedPoint<i16, P>

Available on crate feature i16 only.
Source§

const ONE: Self

Represents 1.
Source§

impl<P: Precision> One for FixedPoint<i32, P>

Available on crate feature i32 only.
Source§

const ONE: Self

Represents 1.
Source§

impl<P: Precision> One for FixedPoint<i64, P>

Available on crate feature i64 only.
Source§

const ONE: Self

Represents 1.
Source§

impl<I: Ord, P: Ord> Ord for FixedPoint<I, P>

Source§

fn cmp(&self, other: &FixedPoint<I, P>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<I: PartialEq, P: PartialEq> PartialEq for FixedPoint<I, P>

Source§

fn eq(&self, other: &FixedPoint<I, P>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<I: PartialOrd, P: PartialOrd> PartialOrd for FixedPoint<I, P>

Source§

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 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<P: Precision> RoundingDiv<FixedPoint<i128, P>> for i128

Available on crate feature i128 only.
Source§

type Output = FixedPoint<i128, P>

Result of division.
Source§

type Error = ArithmeticError

Source§

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
Source§

impl<P: Precision> RoundingDiv<FixedPoint<i16, P>> for i16

Available on crate feature i16 only.
Source§

type Output = FixedPoint<i16, P>

Result of division.
Source§

type Error = ArithmeticError

Source§

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
Source§

impl<P: Precision> RoundingDiv<FixedPoint<i32, P>> for i32

Available on crate feature i32 only.
Source§

type Output = FixedPoint<i32, P>

Result of division.
Source§

type Error = ArithmeticError

Source§

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
Source§

impl<P: Precision> RoundingDiv<FixedPoint<i64, P>> for i64

Available on crate feature i64 only.
Source§

type Output = FixedPoint<i64, P>

Result of division.
Source§

type Error = ArithmeticError

Source§

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
Source§

impl<P: Precision> RoundingDiv<i128> for FixedPoint<i128, P>

Available on crate feature i128 only.
Source§

type Output = FixedPoint<i128, P>

Result of division.
Source§

type Error = ArithmeticError

Source§

fn rdiv(self, rhs: i128, 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
Source§

impl<P: Precision> RoundingDiv<i16> for FixedPoint<i16, P>

Available on crate feature i16 only.
Source§

type Output = FixedPoint<i16, P>

Result of division.
Source§

type Error = ArithmeticError

Source§

fn rdiv(self, rhs: i16, 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
Source§

impl<P: Precision> RoundingDiv<i32> for FixedPoint<i32, P>

Available on crate feature i32 only.
Source§

type Output = FixedPoint<i32, P>

Result of division.
Source§

type Error = ArithmeticError

Source§

fn rdiv(self, rhs: i32, 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
Source§

impl<P: Precision> RoundingDiv<i64> for FixedPoint<i64, P>

Available on crate feature i64 only.
Source§

type Output = FixedPoint<i64, P>

Result of division.
Source§

type Error = ArithmeticError

Source§

fn rdiv(self, rhs: i64, 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
Source§

impl<P: Precision> RoundingDiv for FixedPoint<i128, P>

Available on crate feature i128 only.
Source§

type Output = FixedPoint<i128, P>

Result of division.
Source§

type Error = ArithmeticError

Source§

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
Source§

impl<P: Precision> RoundingDiv for FixedPoint<i16, P>

Available on crate feature i16 only.
Source§

type Output = FixedPoint<i16, P>

Result of division.
Source§

type Error = ArithmeticError

Source§

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
Source§

impl<P: Precision> RoundingDiv for FixedPoint<i32, P>

Available on crate feature i32 only.
Source§

type Output = FixedPoint<i32, P>

Result of division.
Source§

type Error = ArithmeticError

Source§

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
Source§

impl<P: Precision> RoundingDiv for FixedPoint<i64, P>

Available on crate feature i64 only.
Source§

type Output = FixedPoint<i64, P>

Result of division.
Source§

type Error = ArithmeticError

Source§

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
Source§

impl<P: Precision> RoundingMul for FixedPoint<i128, P>

Available on crate feature i128 only.
Source§

type Output = FixedPoint<i128, P>

Result of multiplication.
Source§

type Error = ArithmeticError

Source§

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
Source§

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
Source§

impl<P: Precision> RoundingMul for FixedPoint<i16, P>

Available on crate feature i16 only.
Source§

type Output = FixedPoint<i16, P>

Result of multiplication.
Source§

type Error = ArithmeticError

Source§

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
Source§

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
Source§

impl<P: Precision> RoundingMul for FixedPoint<i32, P>

Available on crate feature i32 only.
Source§

type Output = FixedPoint<i32, P>

Result of multiplication.
Source§

type Error = ArithmeticError

Source§

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
Source§

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
Source§

impl<P: Precision> RoundingMul for FixedPoint<i64, P>

Available on crate feature i64 only.
Source§

type Output = FixedPoint<i64, P>

Result of multiplication.
Source§

type Error = ArithmeticError

Source§

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
Source§

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
Source§

impl<__S: Fallible + ?Sized, I, P> Serialize<__S> for FixedPoint<I, P>
where I: Serialize<__S>, PhantomData<P>: Serialize<__S>,

Source§

fn serialize( &self, serializer: &mut __S, ) -> Result<<Self as Archive>::Resolver, <__S as Fallible>::Error>

Writes the dependencies for the object and returns a resolver that can create the archived type.
Source§

impl<I, P> Serialize for FixedPoint<I, P>
where I: Serialize, Self: Stringify + Clone,

Available on crate feature serde only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<P: Precision> TryFrom<f64> for FixedPoint<i128, P>

Source§

fn try_from(value: f64) -> Result<Self, Self::Error>

Implementation courtesy of rust_decimal crate

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

impl<P: Precision> TryFrom<f64> for FixedPoint<i16, P>

Source§

fn try_from(value: f64) -> Result<Self, Self::Error>

Implementation courtesy of rust_decimal crate

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

impl<P: Precision> TryFrom<f64> for FixedPoint<i32, P>

Source§

fn try_from(value: f64) -> Result<Self, Self::Error>

Implementation courtesy of rust_decimal crate

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

impl<P: Precision> TryFrom<f64> for FixedPoint<i64, P>

Source§

fn try_from(value: f64) -> Result<Self, Self::Error>

Implementation courtesy of rust_decimal crate

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

impl<P: Precision> TryFrom<i128> for FixedPoint<i128, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i128) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i128> for FixedPoint<i16, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i128) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i128> for FixedPoint<i32, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i128) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i128> for FixedPoint<i64, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i128) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i16> for FixedPoint<i128, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i16) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i16> for FixedPoint<i16, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i16) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i16> for FixedPoint<i32, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i16) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i16> for FixedPoint<i64, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i16) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i32> for FixedPoint<i128, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i32) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i32> for FixedPoint<i16, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i32) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i32> for FixedPoint<i32, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i32) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i32> for FixedPoint<i64, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i32) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i64> for FixedPoint<i128, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i64) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i64> for FixedPoint<i16, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i64) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i64> for FixedPoint<i32, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i64) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i64> for FixedPoint<i64, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i64) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i8> for FixedPoint<i128, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i8) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i8> for FixedPoint<i16, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i8) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i8> for FixedPoint<i32, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i8) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<i8> for FixedPoint<i64, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: i8) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<isize> for FixedPoint<i128, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: isize) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<isize> for FixedPoint<i16, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: isize) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<isize> for FixedPoint<i32, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: isize) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<isize> for FixedPoint<i64, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: isize) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u128> for FixedPoint<i128, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u128) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u128> for FixedPoint<i16, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u128) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u128> for FixedPoint<i32, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u128) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u128> for FixedPoint<i64, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u128) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u16> for FixedPoint<i128, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u16) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u16> for FixedPoint<i16, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u16) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u16> for FixedPoint<i32, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u16) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u16> for FixedPoint<i64, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u16) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u32> for FixedPoint<i128, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u32) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u32> for FixedPoint<i16, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u32) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u32> for FixedPoint<i32, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u32) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u32> for FixedPoint<i64, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u32) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u64> for FixedPoint<i128, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u64) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u64> for FixedPoint<i16, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u64) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u64> for FixedPoint<i32, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u64) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u64> for FixedPoint<i64, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u64) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u8> for FixedPoint<i128, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u8) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u8> for FixedPoint<i16, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u8) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u8> for FixedPoint<i32, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u8) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<u8> for FixedPoint<i64, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u8) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<usize> for FixedPoint<i128, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: usize) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<usize> for FixedPoint<i16, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: usize) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<usize> for FixedPoint<i32, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: usize) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> TryFrom<usize> for FixedPoint<i64, P>

Source§

type Error = ConvertError

The type returned in the event of a conversion error.
Source§

fn try_from(value: usize) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<P: Precision> Zero for FixedPoint<i128, P>

Available on crate feature i128 only.
Source§

const ZERO: Self

Represents 0.
Source§

impl<P: Precision> Zero for FixedPoint<i16, P>

Available on crate feature i16 only.
Source§

const ZERO: Self

Represents 0.
Source§

impl<P: Precision> Zero for FixedPoint<i32, P>

Available on crate feature i32 only.
Source§

const ZERO: Self

Represents 0.
Source§

impl<P: Precision> Zero for FixedPoint<i64, P>

Available on crate feature i64 only.
Source§

const ZERO: Self

Represents 0.
Source§

impl<I: Copy, P: Copy> Copy for FixedPoint<I, P>

Source§

impl<P> EncodeLike for FixedPoint<i128, P>

Available on crate features parity and i128 only.
Source§

impl<P> EncodeLike for FixedPoint<i16, P>

Available on crate features parity and i16 only.
Source§

impl<P> EncodeLike for FixedPoint<i32, P>

Available on crate features parity and i32 only.
Source§

impl<P> EncodeLike for FixedPoint<i64, P>

Available on crate features parity and i64 only.
Source§

impl<I: Eq, P: Eq> Eq for FixedPoint<I, P>

Source§

impl<I, P> StructuralPartialEq for FixedPoint<I, P>

Auto Trait Implementations§

§

impl<I, P> Freeze for FixedPoint<I, P>
where I: Freeze,

§

impl<I, P> RefUnwindSafe for FixedPoint<I, P>

§

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§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> ArchiveUnsized for T
where T: Archive,

Source§

type Archived = <T as Archive>::Archived

The archived counterpart of this type. Unlike Archive, it may be unsized. Read more
Source§

fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata

Creates the archived version of the metadata for this value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DecodeAll for T
where T: Decode,

Source§

fn decode_all(input: &mut &[u8]) -> Result<T, Error>

Decode Self and consume all of the given input data. Read more
Source§

impl<T> DecodeLimit for T
where T: Decode,

Source§

fn decode_all_with_depth_limit( limit: u32, input: &mut &[u8], ) -> Result<T, Error>

Decode Self and consume all of the given input data. Read more
Source§

fn decode_with_depth_limit<I>(limit: u32, input: &mut I) -> Result<T, Error>
where I: Input,

Decode Self with the given maximum recursion depth and advance input by the number of bytes consumed. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HasCompact for T
where T: 'static, Compact<T>: for<'a> EncodeAsRef<'a, T> + Decode + From<T> + Into<T>,

Source§

type Type = Compact<T>

The compact type; this can be
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> KeyedVec for T
where T: Codec,

Source§

fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>

Return an encoding of Self prepended by given slice.
Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SerializeUnsized<S> for T
where T: Serialize<S>, S: Fallible + Writer + ?Sized,

Source§

fn serialize_unsized( &self, serializer: &mut S, ) -> Result<usize, <S as Fallible>::Error>

Writes the object and returns the position of the archived type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S> Codec for S
where S: Decode + Encode,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> EncodeLike<&&T> for T
where T: Encode,

Source§

impl<T> EncodeLike<&T> for T
where T: Encode,

Source§

impl<T> EncodeLike<&mut T> for T
where T: Encode,

Source§

impl<T> EncodeLike<Arc<T>> for T
where T: Encode,

Source§

impl<T> EncodeLike<Box<T>> for T
where T: Encode,

Source§

impl<T> EncodeLike<Cow<'_, T>> for T
where T: ToOwned + Encode,

Source§

impl<T> EncodeLike<Rc<T>> for T
where T: Encode,

Source§

impl<S> FullCodec for S
where S: Decode + FullEncode,

Source§

impl<S> FullEncode for S
where S: Encode + EncodeLike,