Skip to main content

Decimal

Struct Decimal 

Source
pub struct Decimal<B: Backing, const DECIMALS: u8> { /* private fields */ }
Expand description

Fixed-point decimal with compile-time backing type and precision.

B is the backing integer type (i32, i64, i128). DECIMALS is the number of fractional digits. Any combination where 10^DECIMALS fits in B is valid — Decimal<i64, 2> for USD or Decimal<i64, 8> for BTC without any macro invocation.

The scale factor 10^DECIMALS is validated at compile time. Invalid combinations (e.g., Decimal<i32, 10>) fail to compile when any associated constant or method is used.

§Examples

use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

const PRICE: D64 = D64::new(100, 50_000_000); // 100.50
const FEE: D64 = D64::from_raw(500_000);       // 0.005
const TOTAL: D64 = match PRICE.checked_add(FEE) {
    Some(v) => v,
    None => panic!("overflow"),
};

Implementations§

Source§

impl<const D: u8> Decimal<i32, D>

Source

pub const fn abs(self) -> Self

Computes the absolute value of self.

§Overflow behavior

The absolute value of Self::MIN cannot be represented as a Self, and attempting to calculate it will cause an overflow. This means that code in debug mode will trigger a panic on this case and optimized code will return Self::MIN without a panic.

Matches the semantics of <backing>::abs. Use checked_abs, saturating_abs, or wrapping_abs for explicit overflow policies.

Source

pub const fn checked_add(self, rhs: Self) -> Option<Self>

Checked addition. Returns None on overflow.

Source

pub const fn checked_sub(self, rhs: Self) -> Option<Self>

Checked subtraction. Returns None on overflow.

Source

pub const fn checked_neg(self) -> Option<Self>

Checked negation. Returns None if self == MIN.

Source

pub const fn checked_abs(self) -> Option<Self>

Checked absolute value. Returns None if self == MIN.

Source

pub const fn saturating_add(self, rhs: Self) -> Self

Saturating addition. Clamps to MIN/MAX on overflow.

Source

pub const fn saturating_sub(self, rhs: Self) -> Self

Saturating subtraction.

Source

pub const fn saturating_neg(self) -> Self

Saturating negation.

Source

pub const fn saturating_abs(self) -> Self

Saturating absolute value.

Source

pub const fn wrapping_add(self, rhs: Self) -> Self

Wrapping addition.

Source

pub const fn wrapping_sub(self, rhs: Self) -> Self

Wrapping subtraction.

Source

pub const fn wrapping_neg(self) -> Self

Wrapping negation.

Source

pub const fn wrapping_abs(self) -> Self

Wrapping absolute value.

Source

pub const fn try_add(self, rhs: Self) -> Result<Self, OverflowError>

Addition returning Result.

Source

pub const fn try_sub(self, rhs: Self) -> Result<Self, OverflowError>

Subtraction returning Result.

Source

pub const fn try_neg(self) -> Result<Self, OverflowError>

Negation returning Result.

Source

pub const fn try_abs(self) -> Result<Self, OverflowError>

Absolute value returning Result.

Source

pub const fn mul_pow2(self, n: u32) -> Self

Multiply by 2^n (left shift on the backing value).

The 10^D scale factor cancels because the multiplier is dimensionless — multiplying the represented value by 2^n is exactly a left shift on the backing.

§Overflow behavior

Matches <backing>::mul semantics: debug builds panic on overflow, release builds wrap (wrapping_shl, which masks n to n mod <backing>::BITS). Use checked_mul_pow2, saturating_mul_pow2, or wrapping_mul_pow2 for explicit overflow policies.

In particular, mul_pow2(v, BITS) in release returns v unchanged — the mask makes this a no-op, not a zeroing.

§Codegen

Lowers to a single backing-width shift in release builds (both constant and variable n). For i32 / i64 backings this is one instruction (~1 cycle); for i128 it expands to a branchless wide-shift sequence (shld + shl on x86-64, ~4-5 cycles).

Source

pub const fn checked_mul_pow2(self, n: u32) -> Option<Self>

Checked multiplication by 2^n. Returns None on overflow.

Uses leading-zero counting to detect overflow without performing the shift first. For positive v, requires n < v.leading_zeros(); for negative v, requires n < (!v).leading_zeros().

Source

pub const fn saturating_mul_pow2(self, n: u32) -> Self

Saturating multiplication by 2^n. Clamps to MAX / MIN on overflow.

Source

pub const fn wrapping_mul_pow2(self, n: u32) -> Self

Wrapping multiplication by 2^n.

Silently wraps on overflow. Note that wrapping_shl masks n to n mod <backing>::BITS, so e.g. shifting by BITS is a no-op rather than zeroing the value.

Source

pub const fn try_mul_pow2(self, n: u32) -> Result<Self, OverflowError>

Multiplication by 2^n returning Result.

Source

pub const fn div_pow2(self, n: u32) -> Self

Divide by 2^n (truncate toward zero).

Semantically identical to / 2^n: truncates toward zero, matching halve, div10, div100, and the rest of the division surface. Invariant: div_pow2(1) == halve().

§Codegen

Constant n folds to a branchless shift + sign-correction sequence (~2 cycles on modern x86-64). Variable n compiles to a hardware signed division (~8-12 cycles on Ice Lake+ / Zen 3+) — use a constant when the shift amount is known.

§Panics

Debug builds panic if n >= <backing>::BITS. Release builds return ZERO, which is the mathematically correct result under truncate-toward-zero: any value divided by 2^n larger than its magnitude is 0.

Source

pub const fn checked_abs_diff(self, other: Self) -> Option<Self>

Overflow-safe absolute difference: |self - other|.

Returns None when the result would exceed MAX — this happens when the operands have opposite signs near the rails, since |MIN - MAX| exceeds MAX on every signed type.

Named checked_abs_diff to match the crate’s checked_* convention for Option-returning operations. There is no bare abs_diff — every call site must acknowledge the overflow case. Stdlib’s <backing>::abs_diff returns an unsigned type to avoid overflow; since Decimal has no unsigned variant, this returns Option<Self> instead.

Source§

impl<const D: u8> Decimal<i64, D>

Source

pub const fn abs(self) -> Self

Computes the absolute value of self.

§Overflow behavior

The absolute value of Self::MIN cannot be represented as a Self, and attempting to calculate it will cause an overflow. This means that code in debug mode will trigger a panic on this case and optimized code will return Self::MIN without a panic.

Matches the semantics of <backing>::abs. Use checked_abs, saturating_abs, or wrapping_abs for explicit overflow policies.

Source

pub const fn checked_add(self, rhs: Self) -> Option<Self>

Checked addition. Returns None on overflow.

Source

pub const fn checked_sub(self, rhs: Self) -> Option<Self>

Checked subtraction. Returns None on overflow.

Source

pub const fn checked_neg(self) -> Option<Self>

Checked negation. Returns None if self == MIN.

Source

pub const fn checked_abs(self) -> Option<Self>

Checked absolute value. Returns None if self == MIN.

Source

pub const fn saturating_add(self, rhs: Self) -> Self

Saturating addition. Clamps to MIN/MAX on overflow.

Source

pub const fn saturating_sub(self, rhs: Self) -> Self

Saturating subtraction.

Source

pub const fn saturating_neg(self) -> Self

Saturating negation.

Source

pub const fn saturating_abs(self) -> Self

Saturating absolute value.

Source

pub const fn wrapping_add(self, rhs: Self) -> Self

Wrapping addition.

Source

pub const fn wrapping_sub(self, rhs: Self) -> Self

Wrapping subtraction.

Source

pub const fn wrapping_neg(self) -> Self

Wrapping negation.

Source

pub const fn wrapping_abs(self) -> Self

Wrapping absolute value.

Source

pub const fn try_add(self, rhs: Self) -> Result<Self, OverflowError>

Addition returning Result.

Source

pub const fn try_sub(self, rhs: Self) -> Result<Self, OverflowError>

Subtraction returning Result.

Source

pub const fn try_neg(self) -> Result<Self, OverflowError>

Negation returning Result.

Source

pub const fn try_abs(self) -> Result<Self, OverflowError>

Absolute value returning Result.

Source

pub const fn mul_pow2(self, n: u32) -> Self

Multiply by 2^n (left shift on the backing value).

The 10^D scale factor cancels because the multiplier is dimensionless — multiplying the represented value by 2^n is exactly a left shift on the backing.

§Overflow behavior

Matches <backing>::mul semantics: debug builds panic on overflow, release builds wrap (wrapping_shl, which masks n to n mod <backing>::BITS). Use checked_mul_pow2, saturating_mul_pow2, or wrapping_mul_pow2 for explicit overflow policies.

In particular, mul_pow2(v, BITS) in release returns v unchanged — the mask makes this a no-op, not a zeroing.

§Codegen

Lowers to a single backing-width shift in release builds (both constant and variable n). For i32 / i64 backings this is one instruction (~1 cycle); for i128 it expands to a branchless wide-shift sequence (shld + shl on x86-64, ~4-5 cycles).

Source

pub const fn checked_mul_pow2(self, n: u32) -> Option<Self>

Checked multiplication by 2^n. Returns None on overflow.

Uses leading-zero counting to detect overflow without performing the shift first. For positive v, requires n < v.leading_zeros(); for negative v, requires n < (!v).leading_zeros().

Source

pub const fn saturating_mul_pow2(self, n: u32) -> Self

Saturating multiplication by 2^n. Clamps to MAX / MIN on overflow.

Source

pub const fn wrapping_mul_pow2(self, n: u32) -> Self

Wrapping multiplication by 2^n.

Silently wraps on overflow. Note that wrapping_shl masks n to n mod <backing>::BITS, so e.g. shifting by BITS is a no-op rather than zeroing the value.

Source

pub const fn try_mul_pow2(self, n: u32) -> Result<Self, OverflowError>

Multiplication by 2^n returning Result.

Source

pub const fn div_pow2(self, n: u32) -> Self

Divide by 2^n (truncate toward zero).

Semantically identical to / 2^n: truncates toward zero, matching halve, div10, div100, and the rest of the division surface. Invariant: div_pow2(1) == halve().

§Codegen

Constant n folds to a branchless shift + sign-correction sequence (~2 cycles on modern x86-64). Variable n compiles to a hardware signed division (~8-12 cycles on Ice Lake+ / Zen 3+) — use a constant when the shift amount is known.

§Panics

Debug builds panic if n >= <backing>::BITS. Release builds return ZERO, which is the mathematically correct result under truncate-toward-zero: any value divided by 2^n larger than its magnitude is 0.

Source

pub const fn checked_abs_diff(self, other: Self) -> Option<Self>

Overflow-safe absolute difference: |self - other|.

Returns None when the result would exceed MAX — this happens when the operands have opposite signs near the rails, since |MIN - MAX| exceeds MAX on every signed type.

Named checked_abs_diff to match the crate’s checked_* convention for Option-returning operations. There is no bare abs_diff — every call site must acknowledge the overflow case. Stdlib’s <backing>::abs_diff returns an unsigned type to avoid overflow; since Decimal has no unsigned variant, this returns Option<Self> instead.

Source§

impl<const D: u8> Decimal<i128, D>

Source

pub const fn abs(self) -> Self

Computes the absolute value of self.

§Overflow behavior

The absolute value of Self::MIN cannot be represented as a Self, and attempting to calculate it will cause an overflow. This means that code in debug mode will trigger a panic on this case and optimized code will return Self::MIN without a panic.

Matches the semantics of <backing>::abs. Use checked_abs, saturating_abs, or wrapping_abs for explicit overflow policies.

Source

pub const fn checked_add(self, rhs: Self) -> Option<Self>

Checked addition. Returns None on overflow.

Source

pub const fn checked_sub(self, rhs: Self) -> Option<Self>

Checked subtraction. Returns None on overflow.

Source

pub const fn checked_neg(self) -> Option<Self>

Checked negation. Returns None if self == MIN.

Source

pub const fn checked_abs(self) -> Option<Self>

Checked absolute value. Returns None if self == MIN.

Source

pub const fn saturating_add(self, rhs: Self) -> Self

Saturating addition. Clamps to MIN/MAX on overflow.

Source

pub const fn saturating_sub(self, rhs: Self) -> Self

Saturating subtraction.

Source

pub const fn saturating_neg(self) -> Self

Saturating negation.

Source

pub const fn saturating_abs(self) -> Self

Saturating absolute value.

Source

pub const fn wrapping_add(self, rhs: Self) -> Self

Wrapping addition.

Source

pub const fn wrapping_sub(self, rhs: Self) -> Self

Wrapping subtraction.

Source

pub const fn wrapping_neg(self) -> Self

Wrapping negation.

Source

pub const fn wrapping_abs(self) -> Self

Wrapping absolute value.

Source

pub const fn try_add(self, rhs: Self) -> Result<Self, OverflowError>

Addition returning Result.

Source

pub const fn try_sub(self, rhs: Self) -> Result<Self, OverflowError>

Subtraction returning Result.

Source

pub const fn try_neg(self) -> Result<Self, OverflowError>

Negation returning Result.

Source

pub const fn try_abs(self) -> Result<Self, OverflowError>

Absolute value returning Result.

Source

pub const fn mul_pow2(self, n: u32) -> Self

Multiply by 2^n (left shift on the backing value).

The 10^D scale factor cancels because the multiplier is dimensionless — multiplying the represented value by 2^n is exactly a left shift on the backing.

§Overflow behavior

Matches <backing>::mul semantics: debug builds panic on overflow, release builds wrap (wrapping_shl, which masks n to n mod <backing>::BITS). Use checked_mul_pow2, saturating_mul_pow2, or wrapping_mul_pow2 for explicit overflow policies.

In particular, mul_pow2(v, BITS) in release returns v unchanged — the mask makes this a no-op, not a zeroing.

§Codegen

Lowers to a single backing-width shift in release builds (both constant and variable n). For i32 / i64 backings this is one instruction (~1 cycle); for i128 it expands to a branchless wide-shift sequence (shld + shl on x86-64, ~4-5 cycles).

Source

pub const fn checked_mul_pow2(self, n: u32) -> Option<Self>

Checked multiplication by 2^n. Returns None on overflow.

Uses leading-zero counting to detect overflow without performing the shift first. For positive v, requires n < v.leading_zeros(); for negative v, requires n < (!v).leading_zeros().

Source

pub const fn saturating_mul_pow2(self, n: u32) -> Self

Saturating multiplication by 2^n. Clamps to MAX / MIN on overflow.

Source

pub const fn wrapping_mul_pow2(self, n: u32) -> Self

Wrapping multiplication by 2^n.

Silently wraps on overflow. Note that wrapping_shl masks n to n mod <backing>::BITS, so e.g. shifting by BITS is a no-op rather than zeroing the value.

Source

pub const fn try_mul_pow2(self, n: u32) -> Result<Self, OverflowError>

Multiplication by 2^n returning Result.

Source

pub const fn div_pow2(self, n: u32) -> Self

Divide by 2^n (truncate toward zero).

Semantically identical to / 2^n: truncates toward zero, matching halve, div10, div100, and the rest of the division surface. Invariant: div_pow2(1) == halve().

§Codegen

Constant n folds to a branchless shift + sign-correction sequence (~2 cycles on modern x86-64). Variable n compiles to a hardware signed division (~8-12 cycles on Ice Lake+ / Zen 3+) — use a constant when the shift amount is known.

§Panics

Debug builds panic if n >= <backing>::BITS. Release builds return ZERO, which is the mathematically correct result under truncate-toward-zero: any value divided by 2^n larger than its magnitude is 0.

Source

pub const fn checked_abs_diff(self, other: Self) -> Option<Self>

Overflow-safe absolute difference: |self - other|.

Returns None when the result would exceed MAX — this happens when the operands have opposite signs near the rails, since |MIN - MAX| exceeds MAX on every signed type.

Named checked_abs_diff to match the crate’s checked_* convention for Option-returning operations. There is no bare abs_diff — every call site must acknowledge the overflow case. Stdlib’s <backing>::abs_diff returns an unsigned type to avoid overflow; since Decimal has no unsigned variant, this returns Option<Self> instead.

Source§

impl<const D: u8> Decimal<i32, D>

Source

pub const fn checked_mul(self, rhs: Self) -> Option<Self>

Checked multiplication. Widens to i64, divides by SCALE.

Source

pub const fn checked_div(self, rhs: Self) -> Option<Self>

Checked division. Returns None if rhs is zero or result overflows.

Source

pub const fn saturating_mul(self, rhs: Self) -> Self

Saturating multiplication.

Source

pub const fn wrapping_mul(self, rhs: Self) -> Self

Wrapping multiplication.

Source

pub const fn saturating_div(self, rhs: Self) -> Self

Saturating division.

Source

pub const fn wrapping_div(self, rhs: Self) -> Self

Wrapping division.

Source

pub const fn mul_int(self, rhs: i32) -> Option<Self>

Multiply by a plain integer (no rescaling).

Source

pub const fn mul_add(self, mul: Self, add: Self) -> Option<Self>

Fused multiply-add: (self * mul) + add with single rescaling.

Source

pub const fn try_mul(self, rhs: Self) -> Result<Self, OverflowError>

Multiplication returning Result.

Source

pub const fn try_div(self, rhs: Self) -> Result<Self, DivError>

Division returning Result with specific error.

Source§

impl<const D: u8> Decimal<i64, D>

Source

pub const fn checked_mul(self, rhs: Self) -> Option<Self>

Checked multiplication. Widens to i128, divides by SCALE.

Source

pub const fn checked_div(self, rhs: Self) -> Option<Self>

Checked division. Returns None if rhs is zero or result overflows.

Division by a runtime value cannot use the chunked path — the divisor isn’t a compile-time constant. Uses native i128 division.

Source

pub const fn saturating_mul(self, rhs: Self) -> Self

Saturating multiplication.

Source

pub const fn wrapping_mul(self, rhs: Self) -> Self

Wrapping multiplication.

Source

pub const fn saturating_div(self, rhs: Self) -> Self

Saturating division.

Source

pub const fn wrapping_div(self, rhs: Self) -> Self

Wrapping division.

Source

pub const fn mul_int(self, rhs: i64) -> Option<Self>

Multiply by a plain integer (no rescaling).

Source

pub const fn mul_add(self, mul: Self, add: Self) -> Option<Self>

Fused multiply-add: (self * mul) + add with single rescaling.

Source

pub const fn try_mul(self, rhs: Self) -> Result<Self, OverflowError>

Multiplication returning Result.

Source

pub const fn try_div(self, rhs: Self) -> Result<Self, DivError>

Division returning Result with specific error.

Source§

impl<const D: u8> Decimal<i128, D>

Source

pub fn checked_mul(self, rhs: Self) -> Option<Self>

Checked multiplication using 192-bit wide arithmetic.

Source

pub fn checked_div(self, rhs: Self) -> Option<Self>

Checked division using 192-bit wide arithmetic.

Source

pub fn saturating_mul(self, rhs: Self) -> Self

Saturating multiplication.

Source

pub fn wrapping_mul(self, rhs: Self) -> Self

Wrapping multiplication.

Source

pub fn saturating_div(self, rhs: Self) -> Self

Saturating division.

Source

pub fn wrapping_div(self, rhs: Self) -> Self

Wrapping division.

Source

pub const fn mul_int(self, rhs: i128) -> Option<Self>

Multiply by a plain integer (no rescaling).

Source

pub fn mul_add(self, mul: Self, add: Self) -> Option<Self>

Fused multiply-add: (self * mul) + add with single rescaling.

Source

pub fn try_mul(self, rhs: Self) -> Result<Self, OverflowError>

Multiplication returning Result.

Source

pub fn try_div(self, rhs: Self) -> Result<Self, DivError>

Division returning Result with specific error.

Source§

impl<const D: u8> Decimal<i32, D>

Source

pub const BYTES: usize = 4

Number of bytes in the serialized representation.

Source

pub const fn to_le_bytes(self) -> [u8; 4]

Returns the underlying value as little-endian bytes.

Source

pub const fn to_be_bytes(self) -> [u8; 4]

Returns the underlying value as big-endian bytes.

Source

pub const fn to_ne_bytes(self) -> [u8; 4]

Returns the underlying value as native-endian bytes.

Source

pub const fn from_le_bytes(bytes: [u8; 4]) -> Self

Reconstructs a Decimal from its little-endian byte representation.

Source

pub const fn from_be_bytes(bytes: [u8; 4]) -> Self

Reconstructs a Decimal from its big-endian byte representation.

Source

pub const fn from_ne_bytes(bytes: [u8; 4]) -> Self

Reconstructs a Decimal from its native-endian byte representation.

Source

pub fn write_le_bytes(&self, buf: &mut [u8])

Writes little-endian bytes into buf. Panics if buf.len() < 4.

Source

pub fn write_be_bytes(&self, buf: &mut [u8])

Writes big-endian bytes into buf. Panics if buf.len() < 4.

Source

pub fn read_le_bytes(buf: &[u8]) -> Self

Reads little-endian bytes from buf. Panics if buf.len() < 4.

Source

pub fn read_be_bytes(buf: &[u8]) -> Self

Reads big-endian bytes from buf. Panics if buf.len() < 4.

Source§

impl<const D: u8> Decimal<i64, D>

Source

pub const BYTES: usize = 8

Number of bytes in the serialized representation.

Source

pub const fn to_le_bytes(self) -> [u8; 8]

Returns the underlying value as little-endian bytes.

Source

pub const fn to_be_bytes(self) -> [u8; 8]

Returns the underlying value as big-endian bytes.

Source

pub const fn to_ne_bytes(self) -> [u8; 8]

Returns the underlying value as native-endian bytes.

Source

pub const fn from_le_bytes(bytes: [u8; 8]) -> Self

Reconstructs a Decimal from its little-endian byte representation.

Source

pub const fn from_be_bytes(bytes: [u8; 8]) -> Self

Reconstructs a Decimal from its big-endian byte representation.

Source

pub const fn from_ne_bytes(bytes: [u8; 8]) -> Self

Reconstructs a Decimal from its native-endian byte representation.

Source

pub fn write_le_bytes(&self, buf: &mut [u8])

Writes little-endian bytes into buf. Panics if buf.len() < 8.

Source

pub fn write_be_bytes(&self, buf: &mut [u8])

Writes big-endian bytes into buf. Panics if buf.len() < 8.

Source

pub fn read_le_bytes(buf: &[u8]) -> Self

Reads little-endian bytes from buf. Panics if buf.len() < 8.

Source

pub fn read_be_bytes(buf: &[u8]) -> Self

Reads big-endian bytes from buf. Panics if buf.len() < 8.

Source§

impl<const D: u8> Decimal<i128, D>

Source

pub const BYTES: usize = 16

Number of bytes in the serialized representation.

Source

pub const fn to_le_bytes(self) -> [u8; 16]

Returns the underlying value as little-endian bytes.

Source

pub const fn to_be_bytes(self) -> [u8; 16]

Returns the underlying value as big-endian bytes.

Source

pub const fn to_ne_bytes(self) -> [u8; 16]

Returns the underlying value as native-endian bytes.

Source

pub const fn from_le_bytes(bytes: [u8; 16]) -> Self

Reconstructs a Decimal from its little-endian byte representation.

Source

pub const fn from_be_bytes(bytes: [u8; 16]) -> Self

Reconstructs a Decimal from its big-endian byte representation.

Source

pub const fn from_ne_bytes(bytes: [u8; 16]) -> Self

Reconstructs a Decimal from its native-endian byte representation.

Source

pub fn write_le_bytes(&self, buf: &mut [u8])

Writes little-endian bytes into buf. Panics if buf.len() < 16.

Source

pub fn write_be_bytes(&self, buf: &mut [u8])

Writes big-endian bytes into buf. Panics if buf.len() < 16.

Source

pub fn read_le_bytes(buf: &[u8]) -> Self

Reads little-endian bytes from buf. Panics if buf.len() < 16.

Source

pub fn read_be_bytes(buf: &[u8]) -> Self

Reads big-endian bytes from buf. Panics if buf.len() < 16.

Source§

impl<const D: u8> Decimal<i32, D>

Source

pub const ZERO: Self

Zero (0).

Source

pub const ONE: Self

One (1.0).

Source

pub const NEG_ONE: Self

Negative one (-1.0).

Source

pub const MAX: Self

Maximum representable value.

Source

pub const MIN: Self

Minimum representable value.

Source

pub const EPSILON: Self

Smallest positive representable value (from_raw(1)).

Represents 1 / 10^D — the resolution of this decimal type.

Source

pub const HALF: Self

One half (0.5).

§Compile-time constraint

Requires D >= 1. Referencing HALF on a Decimal with D = 0 is a compile error — the value 0.5 is not representable with zero fractional digits.

Source

pub const BASIS_POINT: Self

One basis point (0.0001).

§Compile-time constraint

Requires D >= 4. Referencing BASIS_POINT on a Decimal with fewer than 4 fractional digits is a compile error.

Source

pub const TWO: Self

Two (2.0).

§Compile-time constraint

Requires the backing type to be wide enough that 2 * SCALE does not overflow. This holds for all valid D on i32 and i64; on i128 it fails at D = 38.

Source§

impl<const D: u8> Decimal<i64, D>

Source

pub const ZERO: Self

Zero (0).

Source

pub const ONE: Self

One (1.0).

Source

pub const NEG_ONE: Self

Negative one (-1.0).

Source

pub const MAX: Self

Maximum representable value.

Source

pub const MIN: Self

Minimum representable value.

Source

pub const EPSILON: Self

Smallest positive representable value (from_raw(1)).

Represents 1 / 10^D — the resolution of this decimal type.

Source

pub const HALF: Self

One half (0.5).

§Compile-time constraint

Requires D >= 1. Referencing HALF on a Decimal with D = 0 is a compile error — the value 0.5 is not representable with zero fractional digits.

Source

pub const BASIS_POINT: Self

One basis point (0.0001).

§Compile-time constraint

Requires D >= 4. Referencing BASIS_POINT on a Decimal with fewer than 4 fractional digits is a compile error.

Source

pub const TWO: Self

Two (2.0).

§Compile-time constraint

Requires the backing type to be wide enough that 2 * SCALE does not overflow. This holds for all valid D on i32 and i64; on i128 it fails at D = 38.

Source§

impl<const D: u8> Decimal<i128, D>

Source

pub const ZERO: Self

Zero (0).

Source

pub const ONE: Self

One (1.0).

Source

pub const NEG_ONE: Self

Negative one (-1.0).

Source

pub const MAX: Self

Maximum representable value.

Source

pub const MIN: Self

Minimum representable value.

Source

pub const EPSILON: Self

Smallest positive representable value (from_raw(1)).

Represents 1 / 10^D — the resolution of this decimal type.

Source

pub const HALF: Self

One half (0.5).

§Compile-time constraint

Requires D >= 1. Referencing HALF on a Decimal with D = 0 is a compile error — the value 0.5 is not representable with zero fractional digits.

Source

pub const BASIS_POINT: Self

One basis point (0.0001).

§Compile-time constraint

Requires D >= 4. Referencing BASIS_POINT on a Decimal with fewer than 4 fractional digits is a compile error.

Source

pub const TWO: Self

Two (2.0).

§Compile-time constraint

Requires the backing type to be wide enough that 2 * SCALE does not overflow. This holds for all valid D on i32 and i64; on i128 it fails at D = 38.

Source§

impl<const D: u8> Decimal<i32, D>

Source

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

Parses a decimal string exactly. Rejects inputs with more fractional digits than DECIMALS.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let price = D64::from_str_exact("123.45").unwrap();
assert_eq!(price, D64::new(123, 45_000_000));
Source

pub fn from_str_lossy(s: &str) -> Result<Self, ParseError>

Parses a decimal string, rounding excess precision using banker’s rounding (round half to even).

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

// Input has 10 decimal places, D64 has 8 — rounds
let price = D64::from_str_lossy("1.2345678951").unwrap();
assert_eq!(price, D64::new(1, 23_456_790)); // rounded up
Source

pub fn from_utf8_bytes(bytes: &[u8]) -> Result<Self, ParseError>

Parses from a UTF-8 byte slice.

Source

pub const fn from_i32(value: i32) -> Option<Self>

Creates a Decimal from an i32. Returns None on overflow.

Source

pub const fn from_i64(value: i64) -> Option<Self>

Creates a Decimal from an i64. Returns None on overflow.

Source

pub const fn from_u32(value: u32) -> Option<Self>

Creates a Decimal from a u32. Returns None on overflow.

Source

pub const fn from_u64(value: u64) -> Option<Self>

Creates a Decimal from a u64. Returns None on overflow.

Source

pub const fn from_scaled(value: i32, scale: u8) -> Option<Self>

Constructs a Decimal representing value * 10^-scale.

Useful for tick sizes and precision-boundary construction. For example, from_scaled(1, 5) returns a value equal to 0.00001.

Returns None if:

  • scale > D (would require rounding; use from_str_lossy for a rounding policy)
  • The scaled value overflows the backing type
§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let tick = D64::from_scaled(1, 5).unwrap();
assert_eq!(tick, D64::from_str_exact("0.00001").unwrap());

// scale > D
assert!(D64::from_scaled(1, 9).is_none());
Source

pub fn to_f64(self) -> f64

Converts to f64. Exact for values with ≤15 significant digits.

Source

pub fn to_f32(self) -> f32

Converts to f32.

Source

pub fn from_f64(value: f64) -> Result<Self, ConvertError>

Creates a Decimal from an f64. Returns error on NaN, Inf, or overflow.

Requires the std feature (uses f64::round()).

Source

pub fn from_f32(value: f32) -> Result<Self, ConvertError>

Creates a Decimal from an f32.

Requires the std feature (uses f64::round()).

Source§

impl<const D: u8> Decimal<i64, D>

Source

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

Parses a decimal string exactly. Rejects inputs with more fractional digits than DECIMALS.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let price = D64::from_str_exact("123.45").unwrap();
assert_eq!(price, D64::new(123, 45_000_000));
Source

pub fn from_str_lossy(s: &str) -> Result<Self, ParseError>

Parses a decimal string, rounding excess precision using banker’s rounding (round half to even).

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

// Input has 10 decimal places, D64 has 8 — rounds
let price = D64::from_str_lossy("1.2345678951").unwrap();
assert_eq!(price, D64::new(1, 23_456_790)); // rounded up
Source

pub fn from_utf8_bytes(bytes: &[u8]) -> Result<Self, ParseError>

Parses from a UTF-8 byte slice.

Source

pub const fn from_i32(value: i32) -> Option<Self>

Creates a Decimal from an i32. Returns None on overflow.

Source

pub const fn from_i64(value: i64) -> Option<Self>

Creates a Decimal from an i64. Returns None on overflow.

Source

pub const fn from_u32(value: u32) -> Option<Self>

Creates a Decimal from a u32. Returns None on overflow.

Source

pub const fn from_u64(value: u64) -> Option<Self>

Creates a Decimal from a u64. Returns None on overflow.

Source

pub const fn from_scaled(value: i64, scale: u8) -> Option<Self>

Constructs a Decimal representing value * 10^-scale.

Useful for tick sizes and precision-boundary construction. For example, from_scaled(1, 5) returns a value equal to 0.00001.

Returns None if:

  • scale > D (would require rounding; use from_str_lossy for a rounding policy)
  • The scaled value overflows the backing type
§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let tick = D64::from_scaled(1, 5).unwrap();
assert_eq!(tick, D64::from_str_exact("0.00001").unwrap());

// scale > D
assert!(D64::from_scaled(1, 9).is_none());
Source

pub fn to_f64(self) -> f64

Converts to f64. Exact for values with ≤15 significant digits.

Source

pub fn to_f32(self) -> f32

Converts to f32.

Source

pub fn from_f64(value: f64) -> Result<Self, ConvertError>

Creates a Decimal from an f64. Returns error on NaN, Inf, or overflow.

Requires the std feature (uses f64::round()).

Source

pub fn from_f32(value: f32) -> Result<Self, ConvertError>

Creates a Decimal from an f32.

Requires the std feature (uses f64::round()).

Source§

impl<const D: u8> Decimal<i128, D>

Source

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

Parses a decimal string exactly. Rejects inputs with more fractional digits than DECIMALS.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let price = D64::from_str_exact("123.45").unwrap();
assert_eq!(price, D64::new(123, 45_000_000));
Source

pub fn from_str_lossy(s: &str) -> Result<Self, ParseError>

Parses a decimal string, rounding excess precision using banker’s rounding (round half to even).

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

// Input has 10 decimal places, D64 has 8 — rounds
let price = D64::from_str_lossy("1.2345678951").unwrap();
assert_eq!(price, D64::new(1, 23_456_790)); // rounded up
Source

pub fn from_utf8_bytes(bytes: &[u8]) -> Result<Self, ParseError>

Parses from a UTF-8 byte slice.

Source

pub const fn from_i32(value: i32) -> Option<Self>

Creates a Decimal from an i32. Returns None on overflow.

Source

pub const fn from_i64(value: i64) -> Option<Self>

Creates a Decimal from an i64. Returns None on overflow.

Source

pub const fn from_u32(value: u32) -> Option<Self>

Creates a Decimal from a u32. Returns None on overflow.

Source

pub const fn from_u64(value: u64) -> Option<Self>

Creates a Decimal from a u64. Returns None on overflow.

Source

pub const fn from_scaled(value: i128, scale: u8) -> Option<Self>

Constructs a Decimal representing value * 10^-scale.

Useful for tick sizes and precision-boundary construction. For example, from_scaled(1, 5) returns a value equal to 0.00001.

Returns None if:

  • scale > D (would require rounding; use from_str_lossy for a rounding policy)
  • The scaled value overflows the backing type
§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let tick = D64::from_scaled(1, 5).unwrap();
assert_eq!(tick, D64::from_str_exact("0.00001").unwrap());

// scale > D
assert!(D64::from_scaled(1, 9).is_none());
Source

pub fn to_f64(self) -> f64

Converts to f64. Exact for values with ≤15 significant digits.

Source

pub fn to_f32(self) -> f32

Converts to f32.

Source

pub fn from_f64(value: f64) -> Result<Self, ConvertError>

Creates a Decimal from an f64. Returns error on NaN, Inf, or overflow.

Requires the std feature (uses f64::round()).

Source

pub fn from_f32(value: f32) -> Result<Self, ConvertError>

Creates a Decimal from an f32.

Requires the std feature (uses f64::round()).

Source§

impl<const D: u8> Decimal<i32, D>

Source

pub const SCALE: i32

The scale factor 10^DECIMALS.

Validated at compile time: panics if DECIMALS is too large for the backing type.

Source

pub const DECIMALS: u8 = D

The number of fractional digits.

Source

pub const fn from_raw(value: i32) -> Self

Creates a Decimal from a raw pre-scaled value.

No validation — the caller is responsible for ensuring the value is in the expected scale.

Source

pub const fn to_raw(self) -> i32

Returns the raw internal value (scaled by 10^DECIMALS).

Source

pub const fn new(integer: i32, fractional: i32) -> Self

Creates a Decimal from integer and fractional parts.

The fractional part is combined with the integer part as integer * SCALE + fractional. For conventional usage, pass a non-negative fractional less than SCALE. For negative values, negate the integer part: new(-123, 45_000_000)-123.45 (for DECIMALS=8).

§Panics

Panics if the result overflows the backing type.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

const PRICE: D64 = D64::new(100, 50_000_000); // 100.50
const NEG: D64 = D64::new(-50, 25_000_000);   // -50.25
Source

pub const fn from_parts( integer: i32, fractional: i32, negative: bool, ) -> Option<Self>

Construct from integer part, fractional part, and sign.

The fractional part is always positive (represents digits after the decimal point). Use negative to control sign.

This handles the -0.5 case that new() cannot express (because -0 == 0 for integers).

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let neg_half = D64::from_parts(0, 50_000_000, true);
assert_eq!(neg_half.unwrap().to_raw(), -50_000_000);

let pos = D64::from_parts(1, 25_000_000, false);
assert_eq!(pos.unwrap().to_raw(), 125_000_000);
Source

pub const fn is_zero(self) -> bool

Returns true if the value is zero.

Source

pub const fn is_positive(self) -> bool

Returns true if the value is strictly positive.

Source

pub const fn is_negative(self) -> bool

Returns true if the value is strictly negative.

Source

pub const fn signum(self) -> i32

Returns the signum: -1, 0, or 1.

Source§

impl<const D: u8> Decimal<i64, D>

Source

pub const SCALE: i64

The scale factor 10^DECIMALS.

Validated at compile time: panics if DECIMALS is too large for the backing type.

Source

pub const DECIMALS: u8 = D

The number of fractional digits.

Source

pub const fn from_raw(value: i64) -> Self

Creates a Decimal from a raw pre-scaled value.

No validation — the caller is responsible for ensuring the value is in the expected scale.

Source

pub const fn to_raw(self) -> i64

Returns the raw internal value (scaled by 10^DECIMALS).

Source

pub const fn new(integer: i64, fractional: i64) -> Self

Creates a Decimal from integer and fractional parts.

The fractional part is combined with the integer part as integer * SCALE + fractional. For conventional usage, pass a non-negative fractional less than SCALE. For negative values, negate the integer part: new(-123, 45_000_000)-123.45 (for DECIMALS=8).

§Panics

Panics if the result overflows the backing type.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

const PRICE: D64 = D64::new(100, 50_000_000); // 100.50
const NEG: D64 = D64::new(-50, 25_000_000);   // -50.25
Source

pub const fn from_parts( integer: i64, fractional: i64, negative: bool, ) -> Option<Self>

Construct from integer part, fractional part, and sign.

The fractional part is always positive (represents digits after the decimal point). Use negative to control sign.

This handles the -0.5 case that new() cannot express (because -0 == 0 for integers).

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let neg_half = D64::from_parts(0, 50_000_000, true);
assert_eq!(neg_half.unwrap().to_raw(), -50_000_000);

let pos = D64::from_parts(1, 25_000_000, false);
assert_eq!(pos.unwrap().to_raw(), 125_000_000);
Source

pub const fn is_zero(self) -> bool

Returns true if the value is zero.

Source

pub const fn is_positive(self) -> bool

Returns true if the value is strictly positive.

Source

pub const fn is_negative(self) -> bool

Returns true if the value is strictly negative.

Source

pub const fn signum(self) -> i64

Returns the signum: -1, 0, or 1.

Source§

impl<const D: u8> Decimal<i128, D>

Source

pub const SCALE: i128

The scale factor 10^DECIMALS.

Validated at compile time: panics if DECIMALS is too large for the backing type.

Source

pub const DECIMALS: u8 = D

The number of fractional digits.

Source

pub const fn from_raw(value: i128) -> Self

Creates a Decimal from a raw pre-scaled value.

No validation — the caller is responsible for ensuring the value is in the expected scale.

Source

pub const fn to_raw(self) -> i128

Returns the raw internal value (scaled by 10^DECIMALS).

Source

pub const fn new(integer: i128, fractional: i128) -> Self

Creates a Decimal from integer and fractional parts.

The fractional part is combined with the integer part as integer * SCALE + fractional. For conventional usage, pass a non-negative fractional less than SCALE. For negative values, negate the integer part: new(-123, 45_000_000)-123.45 (for DECIMALS=8).

§Panics

Panics if the result overflows the backing type.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

const PRICE: D64 = D64::new(100, 50_000_000); // 100.50
const NEG: D64 = D64::new(-50, 25_000_000);   // -50.25
Source

pub const fn from_parts( integer: i128, fractional: i128, negative: bool, ) -> Option<Self>

Construct from integer part, fractional part, and sign.

The fractional part is always positive (represents digits after the decimal point). Use negative to control sign.

This handles the -0.5 case that new() cannot express (because -0 == 0 for integers).

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let neg_half = D64::from_parts(0, 50_000_000, true);
assert_eq!(neg_half.unwrap().to_raw(), -50_000_000);

let pos = D64::from_parts(1, 25_000_000, false);
assert_eq!(pos.unwrap().to_raw(), 125_000_000);
Source

pub const fn is_zero(self) -> bool

Returns true if the value is zero.

Source

pub const fn is_positive(self) -> bool

Returns true if the value is strictly positive.

Source

pub const fn is_negative(self) -> bool

Returns true if the value is strictly negative.

Source

pub const fn signum(self) -> i128

Returns the signum: -1, 0, or 1.

Source§

impl<const D: u8> Decimal<i32, D>

Source

pub const fn midpoint(self, other: Self) -> Self

Midpoint of two prices: (self + other) / 2.

Overflow-safe midpoint: (self + other) / 2.

Uses the bit-manipulation formula (a & b) + ((a ^ b) >> 1) which is correct for all representable values without intermediate overflow.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let bid = D64::new(100, 0);
let ask = D64::new(101, 0);
assert_eq!(bid.midpoint(ask), D64::new(100, 50_000_000));
Source

pub const fn spread(self, other: Self) -> Option<Self>

Spread between two prices: self - other.

Returns None if self < other (crossed market).

Source

pub const fn round_to_tick(self, tick: Self) -> Option<Self>

Round to nearest tick size.

tick must be positive. Rounds to the nearest multiple of tick using banker’s rounding on the remainder.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let price = D64::new(1, 23_700_000); // 1.237
let tick = D64::new(0, 5_000_000);   // 0.05
assert_eq!(price.round_to_tick(tick), Some(D64::new(1, 25_000_000))); // 1.25
Source

pub const fn floor_to_tick(self, tick: Self) -> Option<Self>

Floor to tick: round down to nearest multiple of tick.

Returns None if the result would overflow.

Source

pub const fn ceil_to_tick(self, tick: Self) -> Option<Self>

Ceil to tick: round up to nearest multiple of tick.

Returns None if the result would overflow.

Source

pub const fn halve(self) -> Self

Divide by 2 using integer division. Truncates toward zero.

The compiler optimizes this to a shift + sign-bit adjustment.

Source

pub const fn div10(self) -> Self

Divide by 10 using integer division.

Source

pub const fn div100(self) -> Self

Divide by 100 using integer division.

Source

pub const fn approx_eq(self, other: Self, tolerance: Self) -> bool

Returns true if self is within tolerance of other.

Equivalent to |self - other| <= tolerance. Returns false when the difference overflows (values with opposite signs near MAX/MIN).

Source

pub const fn clamp_price(self, min: Self, max: Self) -> Self

Clamp to a price range [min, max].

Source

pub const fn is_tick_aligned(self, tick: Self) -> bool

Returns true if self is aligned to the given tick size.

Panics if tick is not positive.

Source

pub const fn round_bps(self, n: u32) -> Option<Self>

Round to nearest N basis points.

Returns None if n == 0 or the tick computation overflows.

§Compile-time constraint

Requires D >= 4. Referencing this method on a Decimal with D < 4 is a compile error.

Source

pub const fn floor_bps(self, n: u32) -> Option<Self>

Floor to N basis points.

Returns None if n == 0 or the tick computation overflows.

§Compile-time constraint

Requires D >= 4. Referencing this method on a Decimal with D < 4 is a compile error.

Source

pub const fn ceil_bps(self, n: u32) -> Option<Self>

Ceil to N basis points.

Returns None if n == 0 or the tick computation overflows.

§Compile-time constraint

Requires D >= 4. Referencing this method on a Decimal with D < 4 is a compile error.

Source§

impl<const D: u8> Decimal<i64, D>

Source

pub const fn midpoint(self, other: Self) -> Self

Midpoint of two prices: (self + other) / 2.

Overflow-safe midpoint: (self + other) / 2.

Uses the bit-manipulation formula (a & b) + ((a ^ b) >> 1) which is correct for all representable values without intermediate overflow.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let bid = D64::new(100, 0);
let ask = D64::new(101, 0);
assert_eq!(bid.midpoint(ask), D64::new(100, 50_000_000));
Source

pub const fn spread(self, other: Self) -> Option<Self>

Spread between two prices: self - other.

Returns None if self < other (crossed market).

Source

pub const fn round_to_tick(self, tick: Self) -> Option<Self>

Round to nearest tick size.

tick must be positive. Rounds to the nearest multiple of tick using banker’s rounding on the remainder.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let price = D64::new(1, 23_700_000); // 1.237
let tick = D64::new(0, 5_000_000);   // 0.05
assert_eq!(price.round_to_tick(tick), Some(D64::new(1, 25_000_000))); // 1.25
Source

pub const fn floor_to_tick(self, tick: Self) -> Option<Self>

Floor to tick: round down to nearest multiple of tick.

Returns None if the result would overflow.

Source

pub const fn ceil_to_tick(self, tick: Self) -> Option<Self>

Ceil to tick: round up to nearest multiple of tick.

Returns None if the result would overflow.

Source

pub const fn halve(self) -> Self

Divide by 2 using integer division. Truncates toward zero.

The compiler optimizes this to a shift + sign-bit adjustment.

Source

pub const fn div10(self) -> Self

Divide by 10 using integer division.

Source

pub const fn div100(self) -> Self

Divide by 100 using integer division.

Source

pub const fn approx_eq(self, other: Self, tolerance: Self) -> bool

Returns true if self is within tolerance of other.

Equivalent to |self - other| <= tolerance. Returns false when the difference overflows (values with opposite signs near MAX/MIN).

Source

pub const fn clamp_price(self, min: Self, max: Self) -> Self

Clamp to a price range [min, max].

Source

pub const fn is_tick_aligned(self, tick: Self) -> bool

Returns true if self is aligned to the given tick size.

Panics if tick is not positive.

Source

pub const fn round_bps(self, n: u32) -> Option<Self>

Round to nearest N basis points.

Returns None if n == 0 or the tick computation overflows.

§Compile-time constraint

Requires D >= 4. Referencing this method on a Decimal with D < 4 is a compile error.

Source

pub const fn floor_bps(self, n: u32) -> Option<Self>

Floor to N basis points.

Returns None if n == 0 or the tick computation overflows.

§Compile-time constraint

Requires D >= 4. Referencing this method on a Decimal with D < 4 is a compile error.

Source

pub const fn ceil_bps(self, n: u32) -> Option<Self>

Ceil to N basis points.

Returns None if n == 0 or the tick computation overflows.

§Compile-time constraint

Requires D >= 4. Referencing this method on a Decimal with D < 4 is a compile error.

Source§

impl<const D: u8> Decimal<i128, D>

Source

pub const fn midpoint(self, other: Self) -> Self

Midpoint of two prices: (self + other) / 2.

Overflow-safe midpoint: (self + other) / 2.

Uses the bit-manipulation formula (a & b) + ((a ^ b) >> 1) which is correct for all representable values without intermediate overflow.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let bid = D64::new(100, 0);
let ask = D64::new(101, 0);
assert_eq!(bid.midpoint(ask), D64::new(100, 50_000_000));
Source

pub const fn spread(self, other: Self) -> Option<Self>

Spread between two prices: self - other.

Returns None if self < other (crossed market).

Source

pub const fn round_to_tick(self, tick: Self) -> Option<Self>

Round to nearest tick size.

tick must be positive. Rounds to the nearest multiple of tick using banker’s rounding on the remainder.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let price = D64::new(1, 23_700_000); // 1.237
let tick = D64::new(0, 5_000_000);   // 0.05
assert_eq!(price.round_to_tick(tick), Some(D64::new(1, 25_000_000))); // 1.25
Source

pub const fn floor_to_tick(self, tick: Self) -> Option<Self>

Floor to tick: round down to nearest multiple of tick.

Returns None if the result would overflow.

Source

pub const fn ceil_to_tick(self, tick: Self) -> Option<Self>

Ceil to tick: round up to nearest multiple of tick.

Returns None if the result would overflow.

Source

pub const fn halve(self) -> Self

Divide by 2 using integer division. Truncates toward zero.

The compiler optimizes this to a shift + sign-bit adjustment.

Source

pub const fn div10(self) -> Self

Divide by 10 using integer division.

Source

pub const fn div100(self) -> Self

Divide by 100 using integer division.

Source

pub const fn approx_eq(self, other: Self, tolerance: Self) -> bool

Returns true if self is within tolerance of other.

Equivalent to |self - other| <= tolerance. Returns false when the difference overflows (values with opposite signs near MAX/MIN).

Source

pub const fn clamp_price(self, min: Self, max: Self) -> Self

Clamp to a price range [min, max].

Source

pub const fn is_tick_aligned(self, tick: Self) -> bool

Returns true if self is aligned to the given tick size.

Panics if tick is not positive.

Source

pub const fn round_bps(self, n: u32) -> Option<Self>

Round to nearest N basis points.

Returns None if n == 0 or the tick computation overflows.

§Compile-time constraint

Requires D >= 4. Referencing this method on a Decimal with D < 4 is a compile error.

Source

pub const fn floor_bps(self, n: u32) -> Option<Self>

Floor to N basis points.

Returns None if n == 0 or the tick computation overflows.

§Compile-time constraint

Requires D >= 4. Referencing this method on a Decimal with D < 4 is a compile error.

Source

pub const fn ceil_bps(self, n: u32) -> Option<Self>

Ceil to N basis points.

Returns None if n == 0 or the tick computation overflows.

§Compile-time constraint

Requires D >= 4. Referencing this method on a Decimal with D < 4 is a compile error.

Source§

impl<const D: u8> Decimal<i32, D>

Source

pub const fn percent_of(self, percent: Self) -> Option<Self>

Compute self * percent / 100 via single truncating division.

percent is in percentage points: 50 means 50%.

Source

pub const fn to_bps(self) -> Option<Self>

Convert to basis points: self * 10000.

Source

pub const fn from_bps(bps: i32) -> Option<Self>

Create from basis points: bps / 10000.

Source

pub const fn mul_div(self, mul: Self, div: Self) -> Option<Self>

Fused multiply-divide: (self * a) / b with single rounding.

Source§

impl<const D: u8> Decimal<i64, D>

Source

pub const fn percent_of(self, percent: Self) -> Option<Self>

Compute self * percent / 100 via single truncating division.

percent is in percentage points: 50 means 50%.

Source

pub const fn to_bps(self) -> Option<Self>

Convert to basis points: self * 10000.

Source

pub const fn from_bps(bps: i64) -> Option<Self>

Create from basis points: bps / 10000.

Source

pub const fn mul_div(self, mul: Self, div: Self) -> Option<Self>

Fused multiply-divide: (self * a) / b with single rounding.

Keeps the full i128 intermediate — single rounding at the end. The primitive behind fee calculation, VWAP, cross-rates.

Source§

impl<const D: u8> Decimal<i32, D>

Source

pub const fn bps_of(self, bps: i32) -> Option<Self>

N basis points of self: self * bps / 10000.

Source

pub const fn pct_of(self, pct: i32) -> Option<Self>

N percent of self: self * pct / 100.

Source

pub const fn shift_bps(self, bps: i32) -> Option<Self>

Adjust self by N basis points: self * (10000 + bps) / 10000.

Source

pub const fn shift_pct(self, pct: i32) -> Option<Self>

Adjust self by N percent: self * (100 + pct) / 100.

Source

pub const fn bps_diff_by(self, other: Self, divisor: Self) -> Option<Self>

Difference in bps relative to divisor: (self - other) / divisor * 10000, returned as a Decimal.

Uses multiply-before-divide: diff * SCALE / divisor * 10000 to preserve precision through the fixed-point division.

Source

pub const fn bps_diff(self, other: Self) -> Option<Self>

Difference in bps: (self - other) * 10000 / other.

Source

pub const fn pct_diff_by(self, other: Self, divisor: Self) -> Option<Self>

Percentage difference relative to divisor: (self - other) / divisor * 100, returned as a Decimal.

Source

pub const fn pct_diff(self, other: Self) -> Option<Self>

Percentage difference: (self - other) * 100 / other.

Source

pub const fn within_bps(self, other: Self, bps: i32) -> bool

Returns true if |self - other| <= |other| * bps / 10000.

Source

pub const fn within_ticks(self, other: Self, n: i64, tick: Self) -> bool

Returns true if |self - other| <= n * tick.

Panics if tick is not positive.

Source

pub const fn add_ticks(self, n: i64, tick: Self) -> Option<Self>

self + n * tick. Returns None on overflow.

Panics if tick is not positive.

Source

pub const fn tick_diff(self, other: Self, tick: Self) -> Option<i64>

(self - other) / tick as an integer tick count.

Truncates toward zero (partial ticks dropped, matching Rust integer division).

§Panics

Panics if tick is not positive.

Source§

impl<const D: u8> Decimal<i64, D>

Source

pub const fn bps_of(self, bps: i32) -> Option<Self>

N basis points of self: self * bps / 10000.

Source

pub const fn pct_of(self, pct: i32) -> Option<Self>

N percent of self: self * pct / 100.

Source

pub const fn shift_bps(self, bps: i32) -> Option<Self>

Adjust self by N basis points: self * (10000 + bps) / 10000.

Source

pub const fn shift_pct(self, pct: i32) -> Option<Self>

Adjust self by N percent: self * (100 + pct) / 100.

Source

pub const fn bps_diff_by(self, other: Self, divisor: Self) -> Option<Self>

Difference in bps relative to divisor: (self - other) / divisor * 10000, returned as a Decimal.

Uses multiply-before-divide: diff * SCALE / divisor * 10000 to preserve precision through the fixed-point division.

Source

pub const fn bps_diff(self, other: Self) -> Option<Self>

Difference in bps: (self - other) * 10000 / other.

Source

pub const fn pct_diff_by(self, other: Self, divisor: Self) -> Option<Self>

Percentage difference relative to divisor: (self - other) / divisor * 100, returned as a Decimal.

Source

pub const fn pct_diff(self, other: Self) -> Option<Self>

Percentage difference: (self - other) * 100 / other.

Source

pub const fn within_bps(self, other: Self, bps: i32) -> bool

Returns true if |self - other| <= |other| * bps / 10000.

Source

pub const fn within_ticks(self, other: Self, n: i64, tick: Self) -> bool

Returns true if |self - other| <= n * tick.

Panics if tick is not positive.

Source

pub const fn add_ticks(self, n: i64, tick: Self) -> Option<Self>

self + n * tick. Returns None on overflow.

Panics if tick is not positive.

Source

pub const fn tick_diff(self, other: Self, tick: Self) -> Option<i64>

(self - other) / tick as an integer tick count.

Truncates toward zero (partial ticks dropped, matching Rust integer division).

§Panics

Panics if tick is not positive.

Source§

impl<const D: u8> Decimal<i128, D>

Source

pub const fn to_bps(self) -> Option<Self>

Convert to basis points: self * 10000.

Source

pub const fn from_bps(bps: i128) -> Option<Self>

Create from basis points: bps / 10000.

Source

pub fn mul_div(self, mul: Self, div: Self) -> Option<Self>

Fused multiply-divide: (self * a) / b with single rounding.

For i128, delegates to checked_mul then checked_div. Not truly fused (two rounding events) — a 256-bit intermediate would be needed for true single-rounding on i128.

Source

pub const fn bps_of(self, bps: i32) -> Option<Self>

N basis points of self: self * bps / 10000.

Uses decomposition to avoid intermediate overflow.

Source

pub const fn pct_of(self, pct: i32) -> Option<Self>

N percent of self: self * pct / 100.

Uses decomposition to avoid intermediate overflow.

Source

pub const fn shift_bps(self, bps: i32) -> Option<Self>

Adjust self by N basis points: self * (10000 + bps) / 10000.

Source

pub const fn shift_pct(self, pct: i32) -> Option<Self>

Adjust self by N percent: self * (100 + pct) / 100.

Source

pub const fn bps_diff_by(self, other: Self, divisor: Self) -> Option<Self>

Difference in bps relative to divisor: (self - other) / divisor * 10000, returned as a Decimal.

Decomposes diff = q*divisor + r, then computes q * SCALE * 10000 + r * SCALE * 10000 / divisor to avoid intermediate overflow on i128.

Source

pub const fn bps_diff(self, other: Self) -> Option<Self>

Difference in bps: (self - other) * 10000 / other.

Source

pub const fn pct_diff_by(self, other: Self, divisor: Self) -> Option<Self>

Percentage difference relative to divisor: (self - other) / divisor * 100, returned as a Decimal.

Source

pub const fn pct_diff(self, other: Self) -> Option<Self>

Percentage difference: (self - other) * 100 / other.

Source

pub const fn within_bps(self, other: Self, bps: i32) -> bool

Returns true if |self - other| <= |other| * bps / 10000.

Source

pub const fn within_ticks(self, other: Self, n: i64, tick: Self) -> bool

Returns true if |self - other| <= n * tick.

Panics if tick is not positive.

Source

pub const fn add_ticks(self, n: i64, tick: Self) -> Option<Self>

self + n * tick. Returns None on overflow.

Panics if tick is not positive.

Source

pub const fn tick_diff(self, other: Self, tick: Self) -> Option<i64>

(self - other) / tick as an integer tick count.

Truncates toward zero (partial ticks dropped, matching Rust integer division).

§Panics

Panics if tick is not positive.

Source§

impl<const D: u8> Decimal<i32, D>

Source

pub fn write_to_buf(&self, buf: &mut [u8]) -> usize

Write decimal representation to a byte buffer.

Returns the number of bytes written. Buffer must be at least 64 bytes. Useful for wire protocol encoding without fmt overhead.

Source§

impl<const D: u8> Decimal<i64, D>

Source

pub fn write_to_buf(&self, buf: &mut [u8]) -> usize

Write decimal representation to a byte buffer.

Returns the number of bytes written. Buffer must be at least 64 bytes. Useful for wire protocol encoding without fmt overhead.

Source§

impl<const D: u8> Decimal<i128, D>

Source

pub fn write_to_buf(&self, buf: &mut [u8]) -> usize

Write decimal representation to a byte buffer.

Returns the number of bytes written. Buffer must be at least 64 bytes. Useful for wire protocol encoding without fmt overhead.

Source§

impl<const D: u8> Decimal<i32, D>

Source

pub const fn floor(self) -> Self

Rounds toward negative infinity.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let pos = D64::new(1, 75_000_000); // 1.75
assert_eq!(pos.floor().to_raw(), D64::new(1, 0).to_raw());

let neg = D64::new(-1, 75_000_000); // -1.75
assert_eq!(neg.floor().to_raw(), D64::new(-2, 0).to_raw());
Source

pub const fn ceil(self) -> Self

Rounds toward positive infinity.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let pos = D64::new(1, 25_000_000); // 1.25
assert_eq!(pos.ceil().to_raw(), D64::new(2, 0).to_raw());

let neg = D64::new(-1, 25_000_000); // -1.25
assert_eq!(neg.ceil().to_raw(), D64::new(-1, 0).to_raw());
Source

pub const fn trunc(self) -> Self

Truncates toward zero (removes fractional part).

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let pos = D64::new(1, 99_000_000); // 1.99
assert_eq!(pos.trunc().to_raw(), D64::new(1, 0).to_raw());

let neg = D64::new(-1, 99_000_000); // -1.99
assert_eq!(neg.trunc().to_raw(), D64::new(-1, 0).to_raw());
Source

pub const fn fract(self) -> Self

Returns the fractional part (same sign as self).

Invariant: self == self.trunc() + self.fract().

Source

pub const fn to_integer(self) -> i32

Returns the integer part as the backing type.

Equivalent to self.trunc().to_raw() / SCALE.

Source

pub const fn round(self) -> Self

Rounds to the nearest integer using banker’s rounding (round half to even).

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

// Half rounds to even
let half_even = D64::new(2, 50_000_000); // 2.5
assert_eq!(half_even.round().to_raw(), D64::new(2, 0).to_raw());

let half_odd = D64::new(3, 50_000_000); // 3.5
assert_eq!(half_odd.round().to_raw(), D64::new(4, 0).to_raw());
Source

pub const fn round_dp(self, dp: u8) -> Self

Rounds to dp decimal places using banker’s rounding.

§Panics

Panics if dp >= DECIMALS.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let price = D64::new(1, 23_456_789); // 1.23456789
let rounded = price.round_dp(2);       // 1.23
assert_eq!(rounded.to_raw(), D64::new(1, 23_000_000).to_raw());
Source§

impl<const D: u8> Decimal<i64, D>

Source

pub const fn floor(self) -> Self

Rounds toward negative infinity.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let pos = D64::new(1, 75_000_000); // 1.75
assert_eq!(pos.floor().to_raw(), D64::new(1, 0).to_raw());

let neg = D64::new(-1, 75_000_000); // -1.75
assert_eq!(neg.floor().to_raw(), D64::new(-2, 0).to_raw());
Source

pub const fn ceil(self) -> Self

Rounds toward positive infinity.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let pos = D64::new(1, 25_000_000); // 1.25
assert_eq!(pos.ceil().to_raw(), D64::new(2, 0).to_raw());

let neg = D64::new(-1, 25_000_000); // -1.25
assert_eq!(neg.ceil().to_raw(), D64::new(-1, 0).to_raw());
Source

pub const fn trunc(self) -> Self

Truncates toward zero (removes fractional part).

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let pos = D64::new(1, 99_000_000); // 1.99
assert_eq!(pos.trunc().to_raw(), D64::new(1, 0).to_raw());

let neg = D64::new(-1, 99_000_000); // -1.99
assert_eq!(neg.trunc().to_raw(), D64::new(-1, 0).to_raw());
Source

pub const fn fract(self) -> Self

Returns the fractional part (same sign as self).

Invariant: self == self.trunc() + self.fract().

Source

pub const fn to_integer(self) -> i64

Returns the integer part as the backing type.

Equivalent to self.trunc().to_raw() / SCALE.

Source

pub const fn round(self) -> Self

Rounds to the nearest integer using banker’s rounding (round half to even).

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

// Half rounds to even
let half_even = D64::new(2, 50_000_000); // 2.5
assert_eq!(half_even.round().to_raw(), D64::new(2, 0).to_raw());

let half_odd = D64::new(3, 50_000_000); // 3.5
assert_eq!(half_odd.round().to_raw(), D64::new(4, 0).to_raw());
Source

pub const fn round_dp(self, dp: u8) -> Self

Rounds to dp decimal places using banker’s rounding.

§Panics

Panics if dp >= DECIMALS.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let price = D64::new(1, 23_456_789); // 1.23456789
let rounded = price.round_dp(2);       // 1.23
assert_eq!(rounded.to_raw(), D64::new(1, 23_000_000).to_raw());
Source§

impl<const D: u8> Decimal<i128, D>

Source

pub const fn floor(self) -> Self

Rounds toward negative infinity.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let pos = D64::new(1, 75_000_000); // 1.75
assert_eq!(pos.floor().to_raw(), D64::new(1, 0).to_raw());

let neg = D64::new(-1, 75_000_000); // -1.75
assert_eq!(neg.floor().to_raw(), D64::new(-2, 0).to_raw());
Source

pub const fn ceil(self) -> Self

Rounds toward positive infinity.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let pos = D64::new(1, 25_000_000); // 1.25
assert_eq!(pos.ceil().to_raw(), D64::new(2, 0).to_raw());

let neg = D64::new(-1, 25_000_000); // -1.25
assert_eq!(neg.ceil().to_raw(), D64::new(-1, 0).to_raw());
Source

pub const fn trunc(self) -> Self

Truncates toward zero (removes fractional part).

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let pos = D64::new(1, 99_000_000); // 1.99
assert_eq!(pos.trunc().to_raw(), D64::new(1, 0).to_raw());

let neg = D64::new(-1, 99_000_000); // -1.99
assert_eq!(neg.trunc().to_raw(), D64::new(-1, 0).to_raw());
Source

pub const fn fract(self) -> Self

Returns the fractional part (same sign as self).

Invariant: self == self.trunc() + self.fract().

Source

pub const fn to_integer(self) -> i128

Returns the integer part as the backing type.

Equivalent to self.trunc().to_raw() / SCALE.

Source

pub const fn round(self) -> Self

Rounds to the nearest integer using banker’s rounding (round half to even).

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

// Half rounds to even
let half_even = D64::new(2, 50_000_000); // 2.5
assert_eq!(half_even.round().to_raw(), D64::new(2, 0).to_raw());

let half_odd = D64::new(3, 50_000_000); // 3.5
assert_eq!(half_odd.round().to_raw(), D64::new(4, 0).to_raw());
Source

pub const fn round_dp(self, dp: u8) -> Self

Rounds to dp decimal places using banker’s rounding.

§Panics

Panics if dp >= DECIMALS.

§Examples
use nexus_decimal::Decimal;
type D64 = Decimal<i64, 8>;

let price = D64::new(1, 23_456_789); // 1.23456789
let rounded = price.round_dp(2);       // 1.23
assert_eq!(rounded.to_raw(), D64::new(1, 23_000_000).to_raw());

Trait Implementations§

Source§

impl<const D: u8> Add for Decimal<i128, D>

Source§

type Output = Decimal<i128, D>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl<const D: u8> Add for Decimal<i32, D>

Source§

type Output = Decimal<i32, D>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl<const D: u8> Add for Decimal<i64, D>

Source§

type Output = Decimal<i64, D>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl<const D: u8> AddAssign for Decimal<i128, D>

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<const D: u8> AddAssign for Decimal<i32, D>

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<const D: u8> AddAssign for Decimal<i64, D>

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<B: Clone + Backing, const DECIMALS: u8> Clone for Decimal<B, DECIMALS>

Source§

fn clone(&self) -> Decimal<B, DECIMALS>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<const D: u8> Debug for Decimal<i128, D>

Source§

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

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

impl<const D: u8> Debug for Decimal<i32, D>

Source§

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

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

impl<const D: u8> Debug for Decimal<i64, D>

Source§

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

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

impl<const D: u8> Default for Decimal<i128, D>

Source§

fn default() -> Self

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

impl<const D: u8> Default for Decimal<i32, D>

Source§

fn default() -> Self

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

impl<const D: u8> Default for Decimal<i64, D>

Source§

fn default() -> Self

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

impl<const D: u8> Display for Decimal<i128, D>

Source§

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

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

impl<const D: u8> Display for Decimal<i32, D>

Source§

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

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

impl<const D: u8> Display for Decimal<i64, D>

Source§

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

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

impl<const D: u8> Div for Decimal<i128, D>

Source§

type Output = Decimal<i128, D>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self

Performs the / operation. Read more
Source§

impl<const D: u8> Div for Decimal<i32, D>

Source§

type Output = Decimal<i32, D>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self

Performs the / operation. Read more
Source§

impl<const D: u8> Div for Decimal<i64, D>

Source§

type Output = Decimal<i64, D>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self

Performs the / operation. Read more
Source§

impl<const D: u8> DivAssign for Decimal<i128, D>

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl<const D: u8> DivAssign for Decimal<i32, D>

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl<const D: u8> DivAssign for Decimal<i64, D>

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl From<i128> for Decimal<i128, 0>

Source§

fn from(value: i128) -> Self

Identity conversion — at D=0, the backing value is the raw value.

Source§

impl From<i16> for Decimal<i128, 0>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 1>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 10>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 11>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 12>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 13>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 14>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 15>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 16>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 17>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 18>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 19>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 2>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 20>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 21>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 22>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 23>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 24>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 25>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 26>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 27>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 28>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 29>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 3>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 30>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 31>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 32>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 33>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 4>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 5>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 6>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 7>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 8>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i128, 9>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i32, 0>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i32, 1>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i32, 2>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i32, 3>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i32, 4>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i64, 0>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i64, 1>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i64, 10>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i64, 11>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i64, 12>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i64, 13>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i64, 14>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i64, 2>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i64, 3>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i64, 4>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i64, 5>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i64, 6>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i64, 7>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i64, 8>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i16> for Decimal<i64, 9>

Source§

fn from(value: i16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 0>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 1>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 10>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 11>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 12>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 13>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 14>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 15>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 16>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 17>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 18>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 19>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 2>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 20>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 21>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 22>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 23>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 24>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 25>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 26>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 27>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 28>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 3>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 4>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 5>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 6>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 7>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 8>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i128, 9>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i32, 0>

Source§

fn from(value: i32) -> Self

Identity conversion — at D=0, the backing value is the raw value.

Source§

impl From<i32> for Decimal<i64, 0>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i64, 1>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i64, 2>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i64, 3>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i64, 4>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i64, 5>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i64, 6>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i64, 7>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i64, 8>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i32> for Decimal<i64, 9>

Source§

fn from(value: i32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 0>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 1>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 10>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 11>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 12>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 13>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 14>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 15>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 16>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 17>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 18>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 19>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 2>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 3>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 4>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 5>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 6>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 7>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 8>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i128, 9>

Source§

fn from(value: i64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i64> for Decimal<i64, 0>

Source§

fn from(value: i64) -> Self

Identity conversion — at D=0, the backing value is the raw value.

Source§

impl From<i8> for Decimal<i128, 0>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 1>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 10>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 11>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 12>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 13>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 14>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 15>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 16>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 17>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 18>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 19>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 2>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 20>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 21>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 22>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 23>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 24>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 25>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 26>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 27>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 28>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 29>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 3>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 30>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 31>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 32>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 33>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 34>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 35>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 36>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 4>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 5>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 6>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 7>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 8>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i128, 9>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i32, 0>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i32, 1>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i32, 2>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i32, 3>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i32, 4>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i32, 5>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i32, 6>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i32, 7>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 0>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 1>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 10>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 11>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 12>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 13>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 14>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 15>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 16>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 2>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 3>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 4>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 5>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 6>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 7>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 8>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<i8> for Decimal<i64, 9>

Source§

fn from(value: i8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 0>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 1>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 10>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 11>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 12>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 13>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 14>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 15>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 16>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 17>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 18>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 19>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 2>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 20>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 21>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 22>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 23>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 24>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 25>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 26>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 27>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 28>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 29>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 3>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 30>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 31>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 32>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 33>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 4>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 5>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 6>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 7>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 8>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i128, 9>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i32, 0>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i32, 1>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i32, 2>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i32, 3>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i32, 4>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i64, 0>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i64, 1>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i64, 10>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i64, 11>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i64, 12>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i64, 13>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i64, 14>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i64, 2>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i64, 3>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i64, 4>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i64, 5>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i64, 6>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i64, 7>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i64, 8>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u16> for Decimal<i64, 9>

Source§

fn from(value: u16) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 0>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 1>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 10>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 11>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 12>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 13>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 14>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 15>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 16>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 17>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 18>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 19>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 2>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 20>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 21>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 22>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 23>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 24>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 25>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 26>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 27>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 28>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 3>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 4>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 5>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 6>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 7>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 8>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i128, 9>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i64, 0>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i64, 1>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i64, 2>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i64, 3>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i64, 4>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i64, 5>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i64, 6>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i64, 7>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i64, 8>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u32> for Decimal<i64, 9>

Source§

fn from(value: u32) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 0>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 1>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 10>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 11>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 12>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 13>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 14>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 15>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 16>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 17>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 18>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 2>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 3>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 4>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 5>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 6>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 7>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 8>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u64> for Decimal<i128, 9>

Source§

fn from(value: u64) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 0>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 1>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 10>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 11>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 12>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 13>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 14>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 15>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 16>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 17>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 18>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 19>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 2>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 20>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 21>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 22>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 23>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 24>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 25>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 26>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 27>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 28>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 29>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 3>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 30>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 31>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 32>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 33>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 34>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 35>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 4>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 5>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 6>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 7>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 8>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i128, 9>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i32, 0>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i32, 1>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i32, 2>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i32, 3>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i32, 4>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i32, 5>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i32, 6>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 0>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 1>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 10>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 11>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 12>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 13>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 14>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 15>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 16>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 2>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 3>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 4>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 5>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 6>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 7>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 8>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl From<u8> for Decimal<i64, 9>

Source§

fn from(value: u8) -> Self

Lossless conversion. The compiler only emits this impl when IntType::MAX * 10^D fits the backing — overflow is impossible by construction (verified at compile time).

Source§

impl<const D: u8> FromStr for Decimal<i128, D>

Source§

type Err = ParseError

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

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

Parses a string s to return a value of this type. Read more
Source§

impl<const D: u8> FromStr for Decimal<i32, D>

Source§

type Err = ParseError

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

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

Parses a string s to return a value of this type. Read more
Source§

impl<const D: u8> FromStr for Decimal<i64, D>

Source§

type Err = ParseError

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

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

Parses a string s to return a value of this type. Read more
Source§

impl<B: Hash + Backing, const DECIMALS: u8> Hash for Decimal<B, DECIMALS>

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<const D: u8> Mul for Decimal<i128, D>

Source§

type Output = Decimal<i128, D>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
Source§

impl<const D: u8> Mul for Decimal<i32, D>

Source§

type Output = Decimal<i32, D>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
Source§

impl<const D: u8> Mul for Decimal<i64, D>

Source§

type Output = Decimal<i64, D>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
Source§

impl<const D: u8> MulAssign for Decimal<i128, D>

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl<const D: u8> MulAssign for Decimal<i32, D>

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl<const D: u8> MulAssign for Decimal<i64, D>

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl<const D: u8> Neg for Decimal<i128, D>

Source§

type Output = Decimal<i128, D>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<const D: u8> Neg for Decimal<i32, D>

Source§

type Output = Decimal<i32, D>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<const D: u8> Neg for Decimal<i64, D>

Source§

type Output = Decimal<i64, D>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<B: Ord + Backing, const DECIMALS: u8> Ord for Decimal<B, DECIMALS>

Source§

fn cmp(&self, other: &Decimal<B, DECIMALS>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

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

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

impl<B: PartialEq + Backing, const DECIMALS: u8> PartialEq for Decimal<B, DECIMALS>

Source§

fn eq(&self, other: &Decimal<B, DECIMALS>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<B: PartialOrd + Backing, const DECIMALS: u8> PartialOrd for Decimal<B, DECIMALS>

Source§

fn partial_cmp(&self, other: &Decimal<B, DECIMALS>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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<'a, const D: u8> Product<&'a Decimal<i128, D>> for Decimal<i128, D>

Source§

fn product<I: Iterator<Item = &'a Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<'a, const D: u8> Product<&'a Decimal<i32, D>> for Decimal<i32, D>

Source§

fn product<I: Iterator<Item = &'a Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<'a, const D: u8> Product<&'a Decimal<i64, D>> for Decimal<i64, D>

Source§

fn product<I: Iterator<Item = &'a Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<const D: u8> Product for Decimal<i128, D>

Source§

fn product<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<const D: u8> Product for Decimal<i32, D>

Source§

fn product<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<const D: u8> Product for Decimal<i64, D>

Source§

fn product<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<const D: u8> Rem for Decimal<i128, D>

Source§

fn rem(self, rhs: Self) -> Self

Remainder on the raw scaled values (self.value % rhs.value).

§Panics

Panics if rhs is zero.

Source§

type Output = Decimal<i128, D>

The resulting type after applying the % operator.
Source§

impl<const D: u8> Rem for Decimal<i32, D>

Source§

fn rem(self, rhs: Self) -> Self

Remainder on the raw scaled values (self.value % rhs.value).

§Panics

Panics if rhs is zero.

Source§

type Output = Decimal<i32, D>

The resulting type after applying the % operator.
Source§

impl<const D: u8> Rem for Decimal<i64, D>

Source§

fn rem(self, rhs: Self) -> Self

Remainder on the raw scaled values (self.value % rhs.value).

§Panics

Panics if rhs is zero.

Source§

type Output = Decimal<i64, D>

The resulting type after applying the % operator.
Source§

impl<const D: u8> RemAssign for Decimal<i128, D>

Source§

fn rem_assign(&mut self, rhs: Self)

Performs the %= operation. Read more
Source§

impl<const D: u8> RemAssign for Decimal<i32, D>

Source§

fn rem_assign(&mut self, rhs: Self)

Performs the %= operation. Read more
Source§

impl<const D: u8> RemAssign for Decimal<i64, D>

Source§

fn rem_assign(&mut self, rhs: Self)

Performs the %= operation. Read more
Source§

impl<const D: u8> Sub for Decimal<i128, D>

Source§

type Output = Decimal<i128, D>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
Source§

impl<const D: u8> Sub for Decimal<i32, D>

Source§

type Output = Decimal<i32, D>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
Source§

impl<const D: u8> Sub for Decimal<i64, D>

Source§

type Output = Decimal<i64, D>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
Source§

impl<const D: u8> SubAssign for Decimal<i128, D>

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl<const D: u8> SubAssign for Decimal<i32, D>

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl<const D: u8> SubAssign for Decimal<i64, D>

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl<'a, const D: u8> Sum<&'a Decimal<i128, D>> for Decimal<i128, D>

Source§

fn sum<I: Iterator<Item = &'a Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<'a, const D: u8> Sum<&'a Decimal<i32, D>> for Decimal<i32, D>

Source§

fn sum<I: Iterator<Item = &'a Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<'a, const D: u8> Sum<&'a Decimal<i64, D>> for Decimal<i64, D>

Source§

fn sum<I: Iterator<Item = &'a Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<const D: u8> Sum for Decimal<i128, D>

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<const D: u8> Sum for Decimal<i32, D>

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<const D: u8> Sum for Decimal<i64, D>

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<const D: u8> TryFrom<f32> for Decimal<i128, D>

Available on crate feature std only.
Source§

type Error = ConvertError

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

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

Performs the conversion.
Source§

impl<const D: u8> TryFrom<f32> for Decimal<i32, D>

Available on crate feature std only.
Source§

type Error = ConvertError

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

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

Performs the conversion.
Source§

impl<const D: u8> TryFrom<f32> for Decimal<i64, D>

Available on crate feature std only.
Source§

type Error = ConvertError

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

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

Performs the conversion.
Source§

impl<const D: u8> TryFrom<f64> for Decimal<i128, D>

Available on crate feature std only.
Source§

type Error = ConvertError

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

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

Performs the conversion.
Source§

impl<const D: u8> TryFrom<f64> for Decimal<i32, D>

Available on crate feature std only.
Source§

type Error = ConvertError

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

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

Performs the conversion.
Source§

impl<const D: u8> TryFrom<f64> for Decimal<i64, D>

Available on crate feature std only.
Source§

type Error = ConvertError

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

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

Performs the conversion.
Source§

impl TryFrom<i64> for Decimal<i128, 20>

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 TryFrom<i64> for Decimal<i128, 21>

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 TryFrom<i64> for Decimal<i128, 22>

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 TryFrom<i64> for Decimal<i128, 23>

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 TryFrom<i64> for Decimal<i128, 24>

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 TryFrom<i64> for Decimal<i128, 25>

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 TryFrom<i64> for Decimal<i128, 26>

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 TryFrom<i64> for Decimal<i128, 27>

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 TryFrom<i64> for Decimal<i128, 28>

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 TryFrom<i64> for Decimal<i128, 29>

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 TryFrom<i64> for Decimal<i128, 30>

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 TryFrom<i64> for Decimal<i128, 31>

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 TryFrom<i64> for Decimal<i128, 32>

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 TryFrom<i64> for Decimal<i128, 33>

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 TryFrom<i64> for Decimal<i128, 34>

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 TryFrom<i64> for Decimal<i128, 35>

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 TryFrom<i64> for Decimal<i128, 36>

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 TryFrom<i64> for Decimal<i128, 37>

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 TryFrom<i64> for Decimal<i128, 38>

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 TryFrom<i64> for Decimal<i32, 0>

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 TryFrom<i64> for Decimal<i32, 1>

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 TryFrom<i64> for Decimal<i32, 2>

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 TryFrom<i64> for Decimal<i32, 3>

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 TryFrom<i64> for Decimal<i32, 4>

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 TryFrom<i64> for Decimal<i32, 5>

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 TryFrom<i64> for Decimal<i32, 6>

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 TryFrom<i64> for Decimal<i32, 7>

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 TryFrom<i64> for Decimal<i32, 8>

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 TryFrom<i64> for Decimal<i32, 9>

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 TryFrom<i64> for Decimal<i64, 1>

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 TryFrom<i64> for Decimal<i64, 10>

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 TryFrom<i64> for Decimal<i64, 11>

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 TryFrom<i64> for Decimal<i64, 12>

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 TryFrom<i64> for Decimal<i64, 13>

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 TryFrom<i64> for Decimal<i64, 14>

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 TryFrom<i64> for Decimal<i64, 15>

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 TryFrom<i64> for Decimal<i64, 16>

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 TryFrom<i64> for Decimal<i64, 17>

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 TryFrom<i64> for Decimal<i64, 18>

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 TryFrom<i64> for Decimal<i64, 2>

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 TryFrom<i64> for Decimal<i64, 3>

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 TryFrom<i64> for Decimal<i64, 4>

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 TryFrom<i64> for Decimal<i64, 5>

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 TryFrom<i64> for Decimal<i64, 6>

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 TryFrom<i64> for Decimal<i64, 7>

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 TryFrom<i64> for Decimal<i64, 8>

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 TryFrom<i64> for Decimal<i64, 9>

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 TryFrom<u64> for Decimal<i128, 19>

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 TryFrom<u64> for Decimal<i128, 20>

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 TryFrom<u64> for Decimal<i128, 21>

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 TryFrom<u64> for Decimal<i128, 22>

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 TryFrom<u64> for Decimal<i128, 23>

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 TryFrom<u64> for Decimal<i128, 24>

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 TryFrom<u64> for Decimal<i128, 25>

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 TryFrom<u64> for Decimal<i128, 26>

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 TryFrom<u64> for Decimal<i128, 27>

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 TryFrom<u64> for Decimal<i128, 28>

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 TryFrom<u64> for Decimal<i128, 29>

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 TryFrom<u64> for Decimal<i128, 30>

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 TryFrom<u64> for Decimal<i128, 31>

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 TryFrom<u64> for Decimal<i128, 32>

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 TryFrom<u64> for Decimal<i128, 33>

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 TryFrom<u64> for Decimal<i128, 34>

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 TryFrom<u64> for Decimal<i128, 35>

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 TryFrom<u64> for Decimal<i128, 36>

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 TryFrom<u64> for Decimal<i128, 37>

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 TryFrom<u64> for Decimal<i128, 38>

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 TryFrom<u64> for Decimal<i32, 0>

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 TryFrom<u64> for Decimal<i32, 1>

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 TryFrom<u64> for Decimal<i32, 2>

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 TryFrom<u64> for Decimal<i32, 3>

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 TryFrom<u64> for Decimal<i32, 4>

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 TryFrom<u64> for Decimal<i32, 5>

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 TryFrom<u64> for Decimal<i32, 6>

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 TryFrom<u64> for Decimal<i32, 7>

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 TryFrom<u64> for Decimal<i32, 8>

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 TryFrom<u64> for Decimal<i32, 9>

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 TryFrom<u64> for Decimal<i64, 0>

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 TryFrom<u64> for Decimal<i64, 1>

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 TryFrom<u64> for Decimal<i64, 10>

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 TryFrom<u64> for Decimal<i64, 11>

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 TryFrom<u64> for Decimal<i64, 12>

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 TryFrom<u64> for Decimal<i64, 13>

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 TryFrom<u64> for Decimal<i64, 14>

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 TryFrom<u64> for Decimal<i64, 15>

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 TryFrom<u64> for Decimal<i64, 16>

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 TryFrom<u64> for Decimal<i64, 17>

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 TryFrom<u64> for Decimal<i64, 18>

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 TryFrom<u64> for Decimal<i64, 2>

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 TryFrom<u64> for Decimal<i64, 3>

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 TryFrom<u64> for Decimal<i64, 4>

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 TryFrom<u64> for Decimal<i64, 5>

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 TryFrom<u64> for Decimal<i64, 6>

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 TryFrom<u64> for Decimal<i64, 7>

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 TryFrom<u64> for Decimal<i64, 8>

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 TryFrom<u64> for Decimal<i64, 9>

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<B: Copy + Backing, const DECIMALS: u8> Copy for Decimal<B, DECIMALS>

Source§

impl<B: Eq + Backing, const DECIMALS: u8> Eq for Decimal<B, DECIMALS>

Source§

impl<B: Backing, const DECIMALS: u8> StructuralPartialEq for Decimal<B, DECIMALS>

Auto Trait Implementations§

§

impl<B, const DECIMALS: u8> Freeze for Decimal<B, DECIMALS>
where B: Freeze,

§

impl<B, const DECIMALS: u8> RefUnwindSafe for Decimal<B, DECIMALS>
where B: RefUnwindSafe,

§

impl<B, const DECIMALS: u8> Send for Decimal<B, DECIMALS>
where B: Send,

§

impl<B, const DECIMALS: u8> Sync for Decimal<B, DECIMALS>
where B: Sync,

§

impl<B, const DECIMALS: u8> Unpin for Decimal<B, DECIMALS>
where B: Unpin,

§

impl<B, const DECIMALS: u8> UnsafeUnpin for Decimal<B, DECIMALS>
where B: UnsafeUnpin,

§

impl<B, const DECIMALS: u8> UnwindSafe for Decimal<B, DECIMALS>
where B: 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> 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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