Struct substrate_fixed::FixedU128
source · pub struct FixedU128<Frac> { /* private fields */ }
Expand description
A 128-bit fixed-point unsigned number with Frac
fractional bits.
Currently Frac
is an Unsigned
as provided by the
typenum crate; it is planned to move to const generics when they
are implemented by the Rust compiler.
Examples
use substrate_fixed::{types::extra::U3, FixedU128};
let eleven = FixedU128::<U3>::from_num(11);
assert_eq!(eleven, FixedU128::<U3>::from_bits(11 << 3));
assert_eq!(eleven, 11);
assert_eq!(eleven.to_string(), "11");
let two_point_75 = eleven / 4;
assert_eq!(two_point_75, FixedU128::<U3>::from_bits(11 << 1));
assert_eq!(two_point_75, 2.75);
assert_eq!(two_point_75.to_string(), "2.8");
Implementations§
source§impl<Frac> FixedU128<Frac>
impl<Frac> FixedU128<Frac>
sourcepub const fn min_value() -> FixedU128<Frac>
pub const fn min_value() -> FixedU128<Frac>
Returns the smallest value that can be represented.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::min_value(), Fix::from_bits(u128::min_value()));
sourcepub const fn max_value() -> FixedU128<Frac>
pub const fn max_value() -> FixedU128<Frac>
Returns the largest value that can be represented.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::max_value(), Fix::from_bits(u128::max_value()));
sourcepub const fn from_bits(bits: u128) -> FixedU128<Frac>
pub const fn from_bits(bits: u128) -> FixedU128<Frac>
Creates a fixed-point number that has a bitwise representation identical to the given integer.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
// 0010.0000 == 2
assert_eq!(Fix::from_bits(0b10_0000), 2);
sourcepub const fn to_bits(self) -> u128
pub const fn to_bits(self) -> u128
Creates an integer that has a bitwise representation identical to the given fixed-point number.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
// 2 is 0010.0000
assert_eq!(Fix::from_num(2).to_bits(), 0b10_0000);
sourcepub fn from_be_bytes(bytes: [u8; 16]) -> FixedU128<Frac>
pub fn from_be_bytes(bytes: [u8; 16]) -> FixedU128<Frac>
Creates a fixed-point number from its representation as a byte array in big endian.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(
Fix::from_be_bytes([0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0]),
Fix::from_bits(0x1234_5678_9ABC_DEF0_1234_5678_9ABC_DEF0)
);
sourcepub fn from_le_bytes(bytes: [u8; 16]) -> FixedU128<Frac>
pub fn from_le_bytes(bytes: [u8; 16]) -> FixedU128<Frac>
Creates a fixed-point number from its representation as a byte array in little endian.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(
Fix::from_le_bytes([0xF0, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, 0xF0, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12]),
Fix::from_bits(0x1234_5678_9ABC_DEF0_1234_5678_9ABC_DEF0)
);
sourcepub fn from_ne_bytes(bytes: [u8; 16]) -> FixedU128<Frac>
pub fn from_ne_bytes(bytes: [u8; 16]) -> FixedU128<Frac>
Creates a fixed-point number from its representation as a byte array in native endian.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(
if cfg!(target_endian = "big") {
Fix::from_ne_bytes([0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0])
} else {
Fix::from_ne_bytes([0xF0, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, 0xF0, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12])
},
Fix::from_bits(0x1234_5678_9ABC_DEF0_1234_5678_9ABC_DEF0)
);
sourcepub fn to_be_bytes(self) -> [u8; 16]
pub fn to_be_bytes(self) -> [u8; 16]
Returns the memory representation of this fixed-point number as a byte array in big-endian byte order.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let val = Fix::from_bits(0x1234_5678_9ABC_DEF0_1234_5678_9ABC_DEF0);
assert_eq!(
val.to_be_bytes(),
[0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0]
);
sourcepub fn to_le_bytes(self) -> [u8; 16]
pub fn to_le_bytes(self) -> [u8; 16]
Returns the memory representation of this fixed-point number as a byte array in little-endian byte order.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let val = Fix::from_bits(0x1234_5678_9ABC_DEF0_1234_5678_9ABC_DEF0);
assert_eq!(
val.to_le_bytes(),
[0xF0, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, 0xF0, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12]
);
sourcepub fn to_ne_bytes(self) -> [u8; 16]
pub fn to_ne_bytes(self) -> [u8; 16]
Returns the memory representation of this fixed-point number as a byte array in native byte order.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let val = Fix::from_bits(0x1234_5678_9ABC_DEF0_1234_5678_9ABC_DEF0);
assert_eq!(
val.to_ne_bytes(),
if cfg!(target_endian = "big") {
[0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0]
} else {
[0xF0, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, 0xF0, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12]
}
);
sourcepub const fn count_ones(self) -> u32
pub const fn count_ones(self) -> u32
Returns the number of ones in the binary representation.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let f = Fix::from_bits(0b11_0010);
assert_eq!(f.count_ones(), 3);
sourcepub const fn count_zeros(self) -> u32
pub const fn count_zeros(self) -> u32
Returns the number of zeros in the binary representation.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let f = Fix::from_bits(!0b11_0010);
assert_eq!(f.count_zeros(), 3);
sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns the number of leading zeros in the binary representation.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let f = Fix::from_bits(0b10_0000);
assert_eq!(f.leading_zeros(), 128 - 6);
sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns the number of trailing zeros in the binary representation.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let f = Fix::from_bits(0b10_0000);
assert_eq!(f.trailing_zeros(), 5);
sourcepub const fn rotate_left(self, n: u32) -> FixedU128<Frac>
pub const fn rotate_left(self, n: u32) -> FixedU128<Frac>
Shifts to the left by n
bits, wrapping the
truncated bits to the right end.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let bits: u128 = (0b111 << (128 - 3)) | 0b1010;
let rot = 0b1010111;
assert_eq!(bits.rotate_left(3), rot);
assert_eq!(Fix::from_bits(bits).rotate_left(3), Fix::from_bits(rot));
sourcepub const fn rotate_right(self, n: u32) -> FixedU128<Frac>
pub const fn rotate_right(self, n: u32) -> FixedU128<Frac>
Shifts to the right by n
bits, wrapping the
truncated bits to the left end.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let bits: u128 = 0b1010111;
let rot = (0b111 << (128 - 3)) | 0b1010;
assert_eq!(bits.rotate_right(3), rot);
assert_eq!(Fix::from_bits(bits).rotate_right(3), Fix::from_bits(rot));
sourcepub const fn is_power_of_two(self) -> bool
pub const fn is_power_of_two(self) -> bool
Returns true
if the fixed-point number is
2k for some integer k.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
// 3/8 is 0.0110
let three_eights = Fix::from_bits(0b0110);
// 1/2 is 0.1000
let half = Fix::from_bits(0b1000);
assert!(!three_eights.is_power_of_two());
assert!(half.is_power_of_two());
sourcepub fn rem_euclid(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
pub fn rem_euclid(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
sourcepub fn next_power_of_two(self) -> FixedU128<Frac>
pub fn next_power_of_two(self) -> FixedU128<Frac>
Returns the smallest power of two that is ≥ self
.
Panics
When debug assertions are enabled, panics if the next power of two is
too large to represent. When debug assertions are not enabled, zero
can be returned, but it is not considered a breaking change if in the
future it panics; if this is not desirable use
checked_next_power_of_two
instead.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
// 3/8 is 0.0110
let three_eights = Fix::from_bits(0b0110);
// 1/2 is 0.1000
let half = Fix::from_bits(0b1000);
assert_eq!(three_eights.next_power_of_two(), half);
assert_eq!(half.next_power_of_two(), half);
sourcepub fn checked_neg(self) -> Option<FixedU128<Frac>>
pub fn checked_neg(self) -> Option<FixedU128<Frac>>
Checked negation. Returns the negated value, or None
on overflow.
Only zero can be negated without overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(0).checked_neg(), Some(Fix::from_num(0)));
assert_eq!(Fix::from_num(5).checked_neg(), None);
sourcepub fn checked_add(self, rhs: FixedU128<Frac>) -> Option<FixedU128<Frac>>
pub fn checked_add(self, rhs: FixedU128<Frac>) -> Option<FixedU128<Frac>>
Checked addition. Returns the sum, or None
on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let one = Fix::from_num(1);
assert_eq!((Fix::max_value() - one).checked_add(one), Some(Fix::max_value()));
assert_eq!(Fix::max_value().checked_add(one), None);
sourcepub fn checked_sub(self, rhs: FixedU128<Frac>) -> Option<FixedU128<Frac>>
pub fn checked_sub(self, rhs: FixedU128<Frac>) -> Option<FixedU128<Frac>>
Checked subtraction. Returns the difference, or None
on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let one = Fix::from_num(1);
assert_eq!((Fix::min_value() + one).checked_sub(one), Some(Fix::min_value()));
assert_eq!(Fix::min_value().checked_sub(one), None);
sourcepub fn checked_rem(self, rhs: FixedU128<Frac>) -> Option<FixedU128<Frac>>
pub fn checked_rem(self, rhs: FixedU128<Frac>) -> Option<FixedU128<Frac>>
Checked remainder. Returns the remainder, or None
if
the divisor is zero.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(1.5).checked_rem(Fix::from_num(1)), Some(Fix::from_num(0.5)));
assert_eq!(Fix::from_num(1.5).checked_rem(Fix::from_num(0)), None);
sourcepub fn checked_mul_int(self, rhs: u128) -> Option<FixedU128<Frac>>
pub fn checked_mul_int(self, rhs: u128) -> Option<FixedU128<Frac>>
sourcepub fn checked_div_int(self, rhs: u128) -> Option<FixedU128<Frac>>
pub fn checked_div_int(self, rhs: u128) -> Option<FixedU128<Frac>>
Checked division by an integer. Returns the quotient, or
None
if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::max_value().checked_div_int(1), Some(Fix::max_value()));
assert_eq!(Fix::from_num(1).checked_div_int(0), None);
sourcepub fn checked_rem_euclid(self, rhs: FixedU128<Frac>) -> Option<FixedU128<Frac>>
pub fn checked_rem_euclid(self, rhs: FixedU128<Frac>) -> Option<FixedU128<Frac>>
Checked remainder for Euclidean division. Returns the
remainder, or None
if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let num = Fix::from_num(7.5);
assert_eq!(num.checked_rem_euclid(Fix::from_num(2)), Some(Fix::from_num(1.5)));
assert_eq!(num.checked_rem_euclid(Fix::from_num(0)), None);
sourcepub fn checked_shl(self, rhs: u32) -> Option<FixedU128<Frac>>
pub fn checked_shl(self, rhs: u32) -> Option<FixedU128<Frac>>
sourcepub fn checked_shr(self, rhs: u32) -> Option<FixedU128<Frac>>
pub fn checked_shr(self, rhs: u32) -> Option<FixedU128<Frac>>
sourcepub fn checked_next_power_of_two(self) -> Option<FixedU128<Frac>>
pub fn checked_next_power_of_two(self) -> Option<FixedU128<Frac>>
Returns the smallest power of two that is ≥ self
, or
None
if the next power of two is too large to represent.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
// 3/8 is 0.0110
let three_eights = Fix::from_bits(0b0110);
// 1/2 is 0.1000
let half = Fix::from_bits(0b1000);
assert_eq!(three_eights.checked_next_power_of_two(), Some(half));
assert!(Fix::max_value().checked_next_power_of_two().is_none());
sourcepub const fn saturating_neg(self) -> FixedU128<Frac>
pub const fn saturating_neg(self) -> FixedU128<Frac>
Saturating negation. Returns the negated value, saturating on overflow.
This method always returns zero.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(0).saturating_neg(), Fix::from_num(0));
assert_eq!(Fix::from_num(5).saturating_neg(), Fix::from_num(0));
sourcepub const fn saturating_add(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
pub const fn saturating_add(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
Saturating addition. Returns the sum, saturating on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(3).saturating_add(Fix::from_num(2)), Fix::from_num(5));
assert_eq!(Fix::max_value().saturating_add(Fix::from_num(1)), Fix::max_value());
sourcepub const fn saturating_sub(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
pub const fn saturating_sub(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
Saturating subtraction. Returns the difference, saturating on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(5).saturating_sub(Fix::from_num(3)), Fix::from_num(2));
assert_eq!(Fix::from_num(0).saturating_sub(Fix::from_num(1)), Fix::from_num(0));
sourcepub const fn saturating_mul_int(self, rhs: u128) -> FixedU128<Frac>
pub const fn saturating_mul_int(self, rhs: u128) -> FixedU128<Frac>
Saturating multiplication by an integer. Returns the product, saturating on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(3).saturating_mul_int(2), Fix::from_num(6));
assert_eq!(Fix::max_value().saturating_mul_int(2), Fix::max_value());
sourcepub const fn wrapping_neg(self) -> FixedU128<Frac>
pub const fn wrapping_neg(self) -> FixedU128<Frac>
Wrapping negation. Returns the negated value, wrapping on overflow.
Only zero can be negated without overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(0).wrapping_neg(), Fix::from_num(0));
assert_eq!(Fix::from_num(5).wrapping_neg(), Fix::wrapping_from_num(-5));
let neg_five_bits = !Fix::from_num(5).to_bits() + 1;
assert_eq!(Fix::from_num(5).wrapping_neg(), Fix::from_bits(neg_five_bits));
sourcepub const fn wrapping_add(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
pub const fn wrapping_add(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
Wrapping addition. Returns the sum, wrapping on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let one = Fix::from_num(1);
let one_minus_bit = one - Fix::from_bits(1);
assert_eq!(Fix::from_num(3).wrapping_add(Fix::from_num(2)), Fix::from_num(5));
assert_eq!(Fix::max_value().wrapping_add(one), one_minus_bit);
sourcepub const fn wrapping_sub(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
pub const fn wrapping_sub(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
Wrapping subtraction. Returns the difference, wrapping on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let one = Fix::from_num(1);
let one_minus_bit = one - Fix::from_bits(1);
assert_eq!(Fix::from_num(5).wrapping_sub(Fix::from_num(3)), Fix::from_num(2));
assert_eq!(Fix::from_num(0).wrapping_sub(one), Fix::max_value() - one_minus_bit);
sourcepub const fn wrapping_mul_int(self, rhs: u128) -> FixedU128<Frac>
pub const fn wrapping_mul_int(self, rhs: u128) -> FixedU128<Frac>
Wrapping multiplication by an integer. Returns the product, wrapping on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(3).wrapping_mul_int(2), Fix::from_num(6));
let wrapped = Fix::from_bits(!0 << 2);
assert_eq!(Fix::max_value().wrapping_mul_int(4), wrapped);
sourcepub fn wrapping_div_int(self, rhs: u128) -> FixedU128<Frac>
pub fn wrapping_div_int(self, rhs: u128) -> FixedU128<Frac>
Wrapping division by an integer. Returns the quotient.
Can never overflow for unsigned values.
Panics
Panics if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
// 1.5 is binary 1.1
let one_point_5 = Fix::from_bits(0b11 << (4 - 1));
assert_eq!(Fix::from_num(3).wrapping_div_int(2), one_point_5);
sourcepub const fn wrapping_shl(self, rhs: u32) -> FixedU128<Frac>
pub const fn wrapping_shl(self, rhs: u32) -> FixedU128<Frac>
Wrapping shift left. Wraps rhs
if rhs
≥ 128,
then shifts and returns the number.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!((Fix::from_num(1) / 2).wrapping_shl(3), Fix::from_num(4));
assert_eq!((Fix::from_num(1) / 2).wrapping_shl(3 + 128), Fix::from_num(4));
sourcepub const fn wrapping_shr(self, rhs: u32) -> FixedU128<Frac>
pub const fn wrapping_shr(self, rhs: u32) -> FixedU128<Frac>
Wrapping shift right. Wraps rhs
if rhs
≥ 128,
then shifts and returns the number.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!((Fix::from_num(4)).wrapping_shr(3), Fix::from_num(1) / 2);
assert_eq!((Fix::from_num(4)).wrapping_shr(3 + 128), Fix::from_num(1) / 2);
sourcepub const fn overflowing_neg(self) -> (FixedU128<Frac>, bool)
pub const fn overflowing_neg(self) -> (FixedU128<Frac>, bool)
Overflowing negation.
Returns a tuple of the negated value and a bool
indicating whether
an overflow has occurred. On overflow, the wrapped value is returned.
Only zero can be negated without overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(0).overflowing_neg(), (Fix::from_num(0), false));
assert_eq!(Fix::from_num(5).overflowing_neg(), Fix::overflowing_from_num(-5));
let neg_five_bits = !Fix::from_num(5).to_bits() + 1;
assert_eq!(Fix::from_num(5).overflowing_neg(), (Fix::from_bits(neg_five_bits), true));
sourcepub const fn overflowing_add(
self,
rhs: FixedU128<Frac>
) -> (FixedU128<Frac>, bool)
pub const fn overflowing_add( self, rhs: FixedU128<Frac> ) -> (FixedU128<Frac>, bool)
Overflowing addition.
Returns a tuple of the sum and a bool
indicating whether an
overflow has occurred. On overflow, the wrapped value is returned.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let one = Fix::from_num(1);
let one_minus_bit = one - Fix::from_bits(1);
assert_eq!(Fix::from_num(3).overflowing_add(Fix::from_num(2)), (Fix::from_num(5), false));
assert_eq!(Fix::max_value().overflowing_add(one), (one_minus_bit, true));
sourcepub const fn overflowing_sub(
self,
rhs: FixedU128<Frac>
) -> (FixedU128<Frac>, bool)
pub const fn overflowing_sub( self, rhs: FixedU128<Frac> ) -> (FixedU128<Frac>, bool)
Overflowing subtraction.
Returns a tuple of the difference and a bool
indicating whether an
overflow has occurred. On overflow, the wrapped value is returned.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let one = Fix::from_num(1);
let one_minus_bit = one - Fix::from_bits(1);
assert_eq!(Fix::from_num(5).overflowing_sub(Fix::from_num(3)), (Fix::from_num(2), false));
assert_eq!(Fix::from_num(0).overflowing_sub(one), (Fix::max_value() - one_minus_bit, true));
sourcepub const fn overflowing_mul_int(self, rhs: u128) -> (FixedU128<Frac>, bool)
pub const fn overflowing_mul_int(self, rhs: u128) -> (FixedU128<Frac>, bool)
Overflowing multiplication by an integer.
Returns a tuple of the product and a bool
indicating whether an
overflow has occurred. On overflow, the wrapped value is returned.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(3).overflowing_mul_int(2), (Fix::from_num(6), false));
let wrapped = Fix::from_bits(!0 << 2);
assert_eq!(Fix::max_value().overflowing_mul_int(4), (wrapped, true));
sourcepub fn overflowing_div_int(self, rhs: u128) -> (FixedU128<Frac>, bool)
pub fn overflowing_div_int(self, rhs: u128) -> (FixedU128<Frac>, bool)
Overflowing division by an integer.
Returns a tuple of the quotient and false
, as the division can never overflow for unsigned values.
Panics
Panics if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
// 1.5 is binary 1.1
let one_point_5 = Fix::from_bits(0b11 << (4 - 1));
assert_eq!(Fix::from_num(3).overflowing_div_int(2), (one_point_5, false));
sourcepub const fn overflowing_shl(self, rhs: u32) -> (FixedU128<Frac>, bool)
pub const fn overflowing_shl(self, rhs: u32) -> (FixedU128<Frac>, bool)
Overflowing shift left.
Returns a tuple of the shifted value and a bool
indicating whether
an overflow has occurred. Overflow occurs when rhs
≥ 128.
On overflow rhs
is wrapped before the shift operation.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!((Fix::from_num(1) / 2).overflowing_shl(3), (Fix::from_num(4), false));
assert_eq!((Fix::from_num(1) / 2).overflowing_shl(3 + 128), (Fix::from_num(4), true));
sourcepub const fn overflowing_shr(self, rhs: u32) -> (FixedU128<Frac>, bool)
pub const fn overflowing_shr(self, rhs: u32) -> (FixedU128<Frac>, bool)
Overflowing shift right.
Returns a tuple of the shifted value and a bool
indicating whether
an overflow has occurred. Overflow occurs when rhs
≥ 128.
On overflow rhs
is wrapped before the shift operation.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!((Fix::from_num(4)).overflowing_shr(3), (Fix::from_num(1) / 2, false));
assert_eq!((Fix::from_num(4)).overflowing_shr(3 + 128), (Fix::from_num(1) / 2, true));
source§impl<Frac: LeEqU128> FixedU128<Frac>
impl<Frac: LeEqU128> FixedU128<Frac>
sourcepub const INT_NBITS: u32 = _
pub const INT_NBITS: u32 = _
The number of integer bits.
Examples
use substrate_fixed::{types::extra::U6, FixedU128};
type Fix = FixedU128<U6>;
assert_eq!(Fix::INT_NBITS, 128 - 6);
sourcepub const FRAC_NBITS: u32 = Frac::U32
pub const FRAC_NBITS: u32 = Frac::U32
The number of fractional bits.
Examples
use substrate_fixed::{types::extra::U6, FixedU128};
type Fix = FixedU128<U6>;
assert_eq!(Fix::FRAC_NBITS, 6);
sourcepub fn int_nbits() -> u32
pub fn int_nbits() -> u32
Returns the number of integer bits.
Examples
use substrate_fixed::{types::extra::U6, FixedU128};
type Fix = FixedU128<U6>;
assert_eq!(Fix::int_nbits(), 128 - 6);
sourcepub fn frac_nbits() -> u32
pub fn frac_nbits() -> u32
Returns the number of fractional bits.
Examples
use substrate_fixed::{types::extra::U6, FixedU128};
type Fix = FixedU128<U6>;
assert_eq!(Fix::frac_nbits(), 6);
sourcepub fn from_num<Src: ToFixed>(src: Src) -> FixedU128<Frac>
pub fn from_num<Src: ToFixed>(src: Src) -> FixedU128<Frac>
Creates a fixed-point number from another number.
The other number can be:
- Another fixed-point number. Any extra fractional bits are truncated.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. - A floating-point number of type
f32
orf64
. If thef16
feature is enabled, it can also be of typef16
orbf16
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other number
src
for whichToFixed
is implemented, in which case this method returnssrc.to_fixed()
.
Panics
For floating-point numbers, panics if the value is not finite.
When debug assertions are enabled, panics if the value does not fit.
When debug assertions are not enabled, the wrapped value can be
returned, but it is not considered a breaking change if in the future
it panics; if wrapping is required use wrapping_from_num
instead.
Examples
use substrate_fixed::{types::extra::U4, types::I16F16, FixedU128};
type Fix = FixedU128<U4>;
// 1.75 is 1.11 in binary
let src = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(Fix::from_num(src), Fix::from_bits(0b111 << (4 - 2)));
assert_eq!(Fix::from_num(3i32), Fix::from_bits(3 << 4));
assert_eq!(Fix::from_num(3i64), Fix::from_bits(3 << 4));
assert_eq!(Fix::from_num(1.75f32), Fix::from_bits(0b111 << (4 - 2)));
assert_eq!(Fix::from_num(1.75f64), Fix::from_bits(0b111 << (4-2)));
sourcepub fn to_num<Dst: FromFixed>(self) -> Dst
pub fn to_num<Dst: FromFixed>(self) -> Dst
Converts a fixed-point number to another number.
The other number can be:
- Another fixed-point number. Any extra fractional bits are truncated.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. Any fractional bits are truncated. - A floating-point number of type
f32
orf64
. If thef16
feature is enabled, it can also be of typef16
orbf16
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other type
Dst
for whichFromFixed
is implemented, in which case this method returnsDst::from_fixed(self)
.
Panics
When debug assertions are enabled, panics if the value does not fit.
When debug assertions are not enabled, the wrapped value can be
returned, but it is not considered a breaking change if in the future
it panics; if wrapping is required use wrapping_to_num
instead.
Examples
use substrate_fixed::{types::extra::U4, types::I30F2, FixedU128};
type Fix = FixedU128<U4>;
// 1.75 is 1.11 in binary
let src = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(src.to_num::<I30F2>(), I30F2::from_bits(0b111));
// src >> 2 is 0.0111, which for I30F2 is truncated to 0.01
assert_eq!((src >> 2u32).to_num::<I30F2>(), I30F2::from_bits(1));
// 2.5 is 10.1 in binary
let two_point_5 = Fix::from_bits(0b101 << (4 - 1));
assert_eq!(two_point_5.to_num::<i32>(), 2);
assert_eq!(two_point_5.to_num::<i64>(), 2);
// 1.625 is 1.101 in binary
let one_point_625 = Fix::from_bits(0b1101 << (4 - 3));
assert_eq!(one_point_625.to_num::<f32>(), 1.625f32);
assert_eq!(one_point_625.to_num::<f64>(), 1.625f64);
sourcepub fn checked_from_num<Src: ToFixed>(src: Src) -> Option<FixedU128<Frac>>
pub fn checked_from_num<Src: ToFixed>(src: Src) -> Option<FixedU128<Frac>>
Creates a fixed-point number from another number if it
fits, otherwise returns None
.
The other number can be:
- Another fixed-point number. Any extra fractional bits are truncated.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. - A floating-point number of type
f32
orf64
. If thef16
feature is enabled, it can also be of typef16
orbf16
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other number
src
for whichToFixed
is implemented, in which case this method returnssrc.checked_to_fixed()
.
Examples
use substrate_fixed::{
types::extra::{U2, U4},
types::I16F16,
FixedU128,
};
type Fix = FixedU128<U4>;
// 1.75 is 1.11 in binary
let src = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(Fix::checked_from_num(src), Some(Fix::from_bits(0b111 << (4 - 2))));
let too_large = FixedU128::<U2>::max_value();
assert!(Fix::checked_from_num(too_large).is_none());
assert_eq!(Fix::checked_from_num(3), Some(Fix::from_bits(3 << 4)));
let too_large = u128::max_value();
assert!(Fix::checked_from_num(too_large).is_none());
let too_small = -1;
assert!(Fix::checked_from_num(too_small).is_none());
// 1.75 is 1.11 in binary
let expected = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(Fix::checked_from_num(1.75f32), Some(expected));
assert_eq!(Fix::checked_from_num(1.75f64), Some(expected));
assert!(Fix::checked_from_num(2e38).is_none());
assert!(Fix::checked_from_num(std::f64::NAN).is_none());
sourcepub fn checked_to_num<Dst: FromFixed>(self) -> Option<Dst>
pub fn checked_to_num<Dst: FromFixed>(self) -> Option<Dst>
Converts a fixed-point number to another number if it
fits, otherwise returns None
.
The other number can be:
- Another fixed-point number. Any extra fractional bits are truncated.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. Any fractional bits are truncated. - A floating-point number of type
f32
orf64
. If thef16
feature is enabled, it can also be of typef16
orbf16
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other type
Dst
for whichFromFixed
is implemented, in which case this method returnsDst::checked_from_fixed(self)
.
Examples
use substrate_fixed::{
types::extra::{U0, U4, U6},
types::I16F16,
FixedU128,
};
type Fix = FixedU128<U4>;
// 1.75 is 1.11 in binary
let src = Fix::from_bits(0b111 << (4 - 2));
let expected = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(src.checked_to_num::<I16F16>(), Some(expected));
type TooFewIntBits = FixedU128<U6>;
assert!(Fix::max_value().checked_to_num::<TooFewIntBits>().is_none());
// 2.5 is 10.1 in binary
let two_point_5 = Fix::from_bits(0b101 << (4 - 1));
assert_eq!(two_point_5.checked_to_num::<i32>(), Some(2));
assert_eq!(two_point_5.checked_to_num::<i64>(), Some(2));
type AllInt = FixedU128<U0>;
assert!(AllInt::max_value().checked_to_num::<i128>().is_none());
// 1.625 is 1.101 in binary
let one_point_625 = Fix::from_bits(0b1101 << (4 - 3));
assert_eq!(one_point_625.checked_to_num::<f32>(), Some(1.625f32));
sourcepub fn saturating_from_num<Src: ToFixed>(src: Src) -> FixedU128<Frac>
pub fn saturating_from_num<Src: ToFixed>(src: Src) -> FixedU128<Frac>
Creates a fixed-point number from another number, saturating if it does not fit.
The other number can be:
- Another fixed-point number. Any extra fractional bits are truncated.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. - A floating-point number of type
f32
orf64
. If thef16
feature is enabled, it can also be of typef16
orbf16
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other number
src
for whichToFixed
is implemented, in which case this method returnssrc.saturating_to_fixed()
.
Panics
This method panics if the value is a floating-point NaN.
Examples
use substrate_fixed::{
types::extra::{U2, U4},
types::I16F16,
FixedU128,
};
type Fix = FixedU128<U4>;
// 1.75 is 1.11 in binary
let src = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(Fix::saturating_from_num(src), Fix::from_bits(0b111 << (4 - 2)));
let too_large = FixedU128::<U2>::max_value();
assert_eq!(Fix::saturating_from_num(too_large), Fix::max_value());
assert_eq!(Fix::saturating_from_num(3), Fix::from_bits(3 << 4));
let too_small = -1;
assert_eq!(Fix::saturating_from_num(too_small), Fix::min_value());
// 1.75 is 1.11 in binary
let expected = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(Fix::saturating_from_num(1.75f32), expected);
assert_eq!(Fix::saturating_from_num(1.75f64), expected);
assert_eq!(Fix::saturating_from_num(2e38), Fix::max_value());
assert_eq!(Fix::saturating_from_num(std::f64::NEG_INFINITY), Fix::min_value());
sourcepub fn saturating_to_num<Dst: FromFixed>(self) -> Dst
pub fn saturating_to_num<Dst: FromFixed>(self) -> Dst
Converts a fixed-point number to another number, saturating the value if it does not fit.
The other number can be:
- Another fixed-point number. Any extra fractional bits are truncated.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. Any fractional bits are truncated. - A floating-point number of type
f32
orf64
. If thef16
feature is enabled, it can also be of typef16
orbf16
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other type
Dst
for whichFromFixed
is implemented, in which case this method returnsDst::saturating_from_fixed(self)
.
Examples
use substrate_fixed::{
types::extra::{U0, U4, U6},
types::I16F16,
FixedU128,
};
type Fix = FixedU128<U4>;
// 1.75 is 1.11 in binary
let src = Fix::from_bits(0b111 << (4 - 2));
let expected = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(src.saturating_to_num::<I16F16>(), expected);
type TooFewIntBits = FixedU128<U6>;
let saturated = Fix::max_value().saturating_to_num::<TooFewIntBits>();
assert_eq!(saturated, TooFewIntBits::max_value());
// 2.5 is 10.1 in binary
let two_point_5 = Fix::from_bits(0b101 << (4 - 1));
assert_eq!(two_point_5.saturating_to_num::<i32>(), 2);
type AllInt = FixedU128<U0>;
assert_eq!(AllInt::max_value().saturating_to_num::<i128>(), i128::max_value());
// 1.625 is 1.101 in binary
let one_point_625 = Fix::from_bits(0b1101 << (4 - 3));
assert_eq!(one_point_625.saturating_to_num::<f32>(), 1.625f32);
sourcepub fn wrapping_from_num<Src: ToFixed>(src: Src) -> FixedU128<Frac>
pub fn wrapping_from_num<Src: ToFixed>(src: Src) -> FixedU128<Frac>
Creates a fixed-point number from another number, wrapping the value on overflow.
The other number can be:
- Another fixed-point number. Any extra fractional bits are truncated.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. - A floating-point number of type
f32
orf64
. If thef16
feature is enabled, it can also be of typef16
orbf16
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other number
src
for whichToFixed
is implemented, in which case this method returnssrc.wrapping_to_fixed()
.
Panics
For floating-point numbers, panics if the value is not finite.
Examples
use substrate_fixed::{
types::extra::{U0, U4},
types::I16F16,
FixedU128,
};
type Fix = FixedU128<U4>;
// 1.75 is 1.11 in binary
let src = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(Fix::wrapping_from_num(src), Fix::from_bits(0b111 << (4 - 2)));
// integer 0b1101 << (128 - 7) will wrap to fixed-point 1010...
let too_large = FixedU128::<U0>::from_bits(0b1101 << (128 - 7));
let wrapped = Fix::from_bits(0b1010 << (128 - 4));
assert_eq!(Fix::wrapping_from_num(too_large), wrapped);
// integer 0b1101 << (128 - 7) will wrap to fixed-point 1010...
let large: u128 = 0b1101 << (128 - 7);
let wrapped = Fix::from_bits(0b1010 << (128 - 4));
assert_eq!(Fix::wrapping_from_num(large), wrapped);
// 1.75 is 1.11 in binary
let expected = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(Fix::wrapping_from_num(1.75f32), expected);
// 1.75 << (128 - 4) wraps to binary 11000...
let large = 1.75 * 2f32.powi(128 - 4);
let wrapped = Fix::from_bits(0b1100 << (128 - 4));
assert_eq!(Fix::wrapping_from_num(large), wrapped);
sourcepub fn wrapping_to_num<Dst: FromFixed>(self) -> Dst
pub fn wrapping_to_num<Dst: FromFixed>(self) -> Dst
Converts a fixed-point number to another number, wrapping the value on overflow.
The other number can be:
- Another fixed-point number. Any extra fractional bits are truncated.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. Any fractional bits are truncated. - A floating-point number of type
f32
orf64
. If thef16
feature is enabled, it can also be of typef16
orbf16
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other type
Dst
for whichFromFixed
is implemented, in which case this method returnsDst::wrapping_from_fixed(self)
.
Examples
use substrate_fixed::{
types::extra::{U0, U4, U6},
types::I16F16,
FixedU128,
};
type Fix = FixedU128<U4>;
// 1.75 is 1.11 in binary
let src = Fix::from_bits(0b111 << (4 - 2));
let expected = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(src.wrapping_to_num::<I16F16>(), expected);
type TooFewIntBits = FixedU128<U6>;
let wrapped = TooFewIntBits::from_bits(Fix::max_value().to_bits() << 2);
assert_eq!(Fix::max_value().wrapping_to_num::<TooFewIntBits>(), wrapped);
// 2.5 is 10.1 in binary
let two_point_5 = Fix::from_bits(0b101 << (4 - 1));
assert_eq!(two_point_5.wrapping_to_num::<i32>(), 2);
type AllInt = FixedU128<U0>;
assert_eq!(AllInt::max_value().wrapping_to_num::<i128>(), -1);
// 1.625 is 1.101 in binary
let one_point_625 = Fix::from_bits(0b1101 << (4 - 3));
assert_eq!(one_point_625.wrapping_to_num::<f32>(), 1.625f32);
sourcepub fn overflowing_from_num<Src: ToFixed>(src: Src) -> (FixedU128<Frac>, bool)
pub fn overflowing_from_num<Src: ToFixed>(src: Src) -> (FixedU128<Frac>, bool)
Creates a fixed-point number from another number.
Returns a tuple of the fixed-point number and a bool
indicating
whether an overflow has occurred. On overflow, the wrapped value is
returned.
The other number can be:
- Another fixed-point number. Any extra fractional bits are truncated.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. - A floating-point number of type
f32
orf64
. If thef16
feature is enabled, it can also be of typef16
orbf16
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other number
src
for whichToFixed
is implemented, in which case this method returnssrc.overflowing_to_fixed()
.
Panics
For floating-point numbers, panics if the value is not finite.
Examples
use substrate_fixed::{
types::extra::{U0, U4},
types::I16F16,
FixedU128,
};
type Fix = FixedU128<U4>;
// 1.75 is 1.11 in binary
let src = I16F16::from_bits(0b111 << (16 - 2));
let expected = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(Fix::overflowing_from_num(src), (expected, false));
// integer 0b1101 << (128 - 7) will wrap to fixed-point 1010...
let too_large = FixedU128::<U0>::from_bits(0b1101 << (128 - 7));
let wrapped = Fix::from_bits(0b1010 << (128 - 4));
assert_eq!(Fix::overflowing_from_num(too_large), (wrapped, true));
assert_eq!(Fix::overflowing_from_num(3), (Fix::from_bits(3 << 4), false));
// integer 0b1101 << (128 - 7) will wrap to fixed-point 1010...
let large: u128 = 0b1101 << (128 - 7);
let wrapped = Fix::from_bits(0b1010 << (128 - 4));
assert_eq!(Fix::overflowing_from_num(large), (wrapped, true));
// 1.75 is 1.11 in binary
let expected = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(Fix::overflowing_from_num(1.75f32), (expected, false));
// 1.75 << (128 - 4) wraps to binary 11000...
let large = 1.75 * 2f32.powi(128 - 4);
let wrapped = Fix::from_bits(0b1100 << (128 - 4));
assert_eq!(Fix::overflowing_from_num(large), (wrapped, true));
sourcepub fn overflowing_to_num<Dst: FromFixed>(self) -> (Dst, bool)
pub fn overflowing_to_num<Dst: FromFixed>(self) -> (Dst, bool)
Converts a fixed-point number to another number.
Returns a tuple of the number and a bool
indicating whether an
overflow has occurred. On overflow, the wrapped value is returned.
The other number can be:
- Another fixed-point number. Any extra fractional bits are truncated.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. Any fractional bits are truncated. - A floating-point number of type
f32
orf64
. If thef16
feature is enabled, it can also be of typef16
orbf16
. For this conversion, the method rounds to the nearest, with ties rounding to even. - Any other type
Dst
for whichFromFixed
is implemented, in which case this method returnsDst::overflowing_from_fixed(self)
.
Examples
use substrate_fixed::{
types::extra::{U0, U4, U6},
types::I16F16,
FixedU128,
};
type Fix = FixedU128<U4>;
// 1.75 is 1.11 in binary
let src = Fix::from_bits(0b111 << (4 - 2));
let expected = I16F16::from_bits(0b111 << (16 - 2));
assert_eq!(src.overflowing_to_num::<I16F16>(), (expected, false));
type TooFewIntBits = FixedU128<U6>;
let wrapped = TooFewIntBits::from_bits(Fix::max_value().to_bits() << 2);
assert_eq!(Fix::max_value().overflowing_to_num::<TooFewIntBits>(), (wrapped, true));
// 2.5 is 10.1 in binary
let two_point_5 = Fix::from_bits(0b101 << (4 - 1));
assert_eq!(two_point_5.overflowing_to_num::<i32>(), (2, false));
let does_not_fit = FixedU128::<U0>::max_value();
let wrapped = -1i128;
assert_eq!(does_not_fit.overflowing_to_num::<i128>(), (wrapped, true));
// 1.625 is 1.101 in binary
let one_point_625 = Fix::from_bits(0b1101 << (4 - 3));
assert_eq!(one_point_625.overflowing_to_num::<f32>(), (1.625f32, false));
sourcepub fn from_str_binary(src: &str) -> Result<FixedU128<Frac>, ParseFixedError>
pub fn from_str_binary(src: &str) -> Result<FixedU128<Frac>, ParseFixedError>
Parses a string slice containing binary digits to return a fixed-point number.
Rounding is to the nearest, with ties rounded to even.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
// 1.75 is 1.11 in binary
let f = Fix::from_str_binary("1.11");
let check = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(f, Ok(check));
sourcepub fn from_str_octal(src: &str) -> Result<FixedU128<Frac>, ParseFixedError>
pub fn from_str_octal(src: &str) -> Result<FixedU128<Frac>, ParseFixedError>
Parses a string slice containing octal digits to return a fixed-point number.
Rounding is to the nearest, with ties rounded to even.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
// 1.75 is 1.11 in binary, 1.6 in octal
let f = Fix::from_str_octal("1.6");
let check = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(f, Ok(check));
sourcepub fn from_str_hex(src: &str) -> Result<FixedU128<Frac>, ParseFixedError>
pub fn from_str_hex(src: &str) -> Result<FixedU128<Frac>, ParseFixedError>
Parses a string slice containing hexadecimal digits to return a fixed-point number.
Rounding is to the nearest, with ties rounded to even.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
// 1.75 is 1.11 in binary, 1.C in hexadecimal
let f = Fix::from_str_hex("1.C");
let check = Fix::from_bits(0b111 << (4 - 2));
assert_eq!(f, Ok(check));
sourcepub fn saturating_from_str(
src: &str
) -> Result<FixedU128<Frac>, ParseFixedError>
pub fn saturating_from_str( src: &str ) -> Result<FixedU128<Frac>, ParseFixedError>
Parses a string slice containing decimal digits to return a fixed-point number, saturating on overflow.
Rounding is to the nearest, with ties rounded to even.
Examples
use substrate_fixed::types::U8F8;
assert_eq!(U8F8::saturating_from_str("9999"), Ok(U8F8::max_value()));
assert_eq!(U8F8::saturating_from_str("-1"), Ok(U8F8::from_num(0)));
sourcepub fn saturating_from_str_binary(
src: &str
) -> Result<FixedU128<Frac>, ParseFixedError>
pub fn saturating_from_str_binary( src: &str ) -> Result<FixedU128<Frac>, ParseFixedError>
Parses a string slice containing binary digits to return a fixed-point number, saturating on overflow.
Rounding is to the nearest, with ties rounded to even.
Examples
use substrate_fixed::types::U8F8;
assert_eq!(U8F8::saturating_from_str_binary("101100111000"), Ok(U8F8::max_value()));
assert_eq!(U8F8::saturating_from_str_binary("-1"), Ok(U8F8::from_num(0)));
sourcepub fn saturating_from_str_octal(
src: &str
) -> Result<FixedU128<Frac>, ParseFixedError>
pub fn saturating_from_str_octal( src: &str ) -> Result<FixedU128<Frac>, ParseFixedError>
Parses a string slice containing octal digits to return a fixed-point number, saturating on overflow.
Rounding is to the nearest, with ties rounded to even.
Examples
use substrate_fixed::types::U8F8;
assert_eq!(U8F8::saturating_from_str_octal("7777"), Ok(U8F8::max_value()));
assert_eq!(U8F8::saturating_from_str_octal("-1"), Ok(U8F8::from_num(0)));
sourcepub fn saturating_from_str_hex(
src: &str
) -> Result<FixedU128<Frac>, ParseFixedError>
pub fn saturating_from_str_hex( src: &str ) -> Result<FixedU128<Frac>, ParseFixedError>
Prases a string slice containing hexadecimal digits to return a fixed-point number, saturating on overflow.
Rounding is to the nearest, with ties rounded to even.
Examples
use substrate_fixed::types::U8F8;
assert_eq!(U8F8::saturating_from_str_hex("FFFF"), Ok(U8F8::max_value()));
assert_eq!(U8F8::saturating_from_str_hex("-1"), Ok(U8F8::from_num(0)));
sourcepub fn wrapping_from_str(src: &str) -> Result<FixedU128<Frac>, ParseFixedError>
pub fn wrapping_from_str(src: &str) -> Result<FixedU128<Frac>, ParseFixedError>
Parses a string slice containing decimal digits to return a fixed-point number, wrapping on overflow.
Rounding is to the nearest, with ties rounded to even.
Examples
use substrate_fixed::types::U8F8;
// 9999.5 = 15.5 + 256 × n
assert_eq!(U8F8::wrapping_from_str("9999.5"), Ok(U8F8::from_num(15.5)));
assert_eq!(U8F8::wrapping_from_str("-9999.5"), Ok(U8F8::from_num(240.5)));
sourcepub fn wrapping_from_str_binary(
src: &str
) -> Result<FixedU128<Frac>, ParseFixedError>
pub fn wrapping_from_str_binary( src: &str ) -> Result<FixedU128<Frac>, ParseFixedError>
Parses a string slice containing binary digits to return a fixed-point number, wrapping on overflow.
Rounding is to the nearest, with ties rounded to even.
Examples
use substrate_fixed::types::U8F8;
let check = U8F8::from_bits(0b1110001 << (8 - 1));
assert_eq!(U8F8::wrapping_from_str_binary("101100111000.1"), Ok(check));
assert_eq!(U8F8::wrapping_from_str_binary("-101100111000.1"), Ok(check.wrapping_neg()));
sourcepub fn wrapping_from_str_octal(
src: &str
) -> Result<FixedU128<Frac>, ParseFixedError>
pub fn wrapping_from_str_octal( src: &str ) -> Result<FixedU128<Frac>, ParseFixedError>
Parses a string slice containing octal digits to return a fixed-point number, wrapping on overflow.
Rounding is to the nearest, with ties rounded to even.
Examples
use substrate_fixed::types::U8F8;
let check = U8F8::from_bits(0o1654 << (8 - 3));
assert_eq!(U8F8::wrapping_from_str_octal("7165.4"), Ok(check));
assert_eq!(U8F8::wrapping_from_str_octal("-7165.4"), Ok(check.wrapping_neg()));
sourcepub fn wrapping_from_str_hex(
src: &str
) -> Result<FixedU128<Frac>, ParseFixedError>
pub fn wrapping_from_str_hex( src: &str ) -> Result<FixedU128<Frac>, ParseFixedError>
Parses a string slice containing hexadecimal digits to return a fixed-point number, wrapping on overflow.
Rounding is to the nearest, with ties rounded to even.
Examples
use substrate_fixed::types::U8F8;
let check = U8F8::from_bits(0xFFE);
assert_eq!(U8F8::wrapping_from_str_hex("C0F.FE"), Ok(check));
assert_eq!(U8F8::wrapping_from_str_hex("-C0F.FE"), Ok(check.wrapping_neg()));
sourcepub fn overflowing_from_str(
src: &str
) -> Result<(FixedU128<Frac>, bool), ParseFixedError>
pub fn overflowing_from_str( src: &str ) -> Result<(FixedU128<Frac>, bool), ParseFixedError>
Parses a string slice containing decimal digits to return a fixed-point number.
Returns a tuple of the fixed-point number and a bool
indicating
whether an overflow has occurred. On overflow, the wrapped value is
returned.
Rounding is to the nearest, with ties rounded to even.
Examples
use substrate_fixed::types::U8F8;
assert_eq!(U8F8::overflowing_from_str("99.5"), Ok((U8F8::from_num(99.5), false)));
// 9999.5 = 15.5 + 256 × n
assert_eq!(U8F8::overflowing_from_str("9999.5"), Ok((U8F8::from_num(15.5), true)));
sourcepub fn overflowing_from_str_binary(
src: &str
) -> Result<(FixedU128<Frac>, bool), ParseFixedError>
pub fn overflowing_from_str_binary( src: &str ) -> Result<(FixedU128<Frac>, bool), ParseFixedError>
Parses a string slice containing binary digits to return a fixed-point number.
Returns a tuple of the fixed-point number and a bool
indicating
whether an overflow has occurred. On overflow, the wrapped value is
returned.
Rounding is to the nearest, with ties rounded to even.
Examples
use substrate_fixed::types::U8F8;
let check = U8F8::from_bits(0b1110001 << (8 - 1));
assert_eq!(U8F8::overflowing_from_str_binary("111000.1"), Ok((check, false)));
assert_eq!(U8F8::overflowing_from_str_binary("101100111000.1"), Ok((check, true)));
sourcepub fn overflowing_from_str_octal(
src: &str
) -> Result<(FixedU128<Frac>, bool), ParseFixedError>
pub fn overflowing_from_str_octal( src: &str ) -> Result<(FixedU128<Frac>, bool), ParseFixedError>
Parses a string slice containing octal digits to return a fixed-point number.
Returns a tuple of the fixed-point number and a bool
indicating
whether an overflow has occurred. On overflow, the wrapped value is
returned.
Rounding is to the nearest, with ties rounded to even.
Examples
use substrate_fixed::types::U8F8;
let check = U8F8::from_bits(0o1654 << (8 - 3));
assert_eq!(U8F8::overflowing_from_str_octal("165.4"), Ok((check, false)));
assert_eq!(U8F8::overflowing_from_str_octal("7165.4"), Ok((check, true)));
sourcepub fn overflowing_from_str_hex(
src: &str
) -> Result<(FixedU128<Frac>, bool), ParseFixedError>
pub fn overflowing_from_str_hex( src: &str ) -> Result<(FixedU128<Frac>, bool), ParseFixedError>
Parses a string slice containing hexadecimal digits to return a fixed-point number.
Returns a tuple of the fixed-point number and a bool
indicating
whether an overflow has occurred. On overflow, the wrapped value is
returned.
Rounding is to the nearest, with ties rounded to even.
Examples
use substrate_fixed::types::U8F8;
let check = U8F8::from_bits(0xFFE);
assert_eq!(U8F8::overflowing_from_str_hex("F.FE"), Ok((check, false)));
assert_eq!(U8F8::overflowing_from_str_hex("C0F.FE"), Ok((check, true)));
sourcepub fn int(self) -> FixedU128<Frac>
pub fn int(self) -> FixedU128<Frac>
Returns the integer part.
Note that for unsigned numbers, this is equivalent to floor
.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
// 0010.0000
let two = Fix::from_num(2);
// 0010.0100
let two_and_quarter = two + two / 8;
assert_eq!(two_and_quarter.int(), two);
sourcepub fn frac(self) -> FixedU128<Frac>
pub fn frac(self) -> FixedU128<Frac>
Returns the fractional part.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
// 0000.0100
let quarter = Fix::from_num(1) / 4;
// 0010.0100
let two_and_quarter = quarter * 9;
assert_eq!(two_and_quarter.frac(), quarter);
sourcepub fn round_to_zero(self) -> FixedU128<Frac>
pub fn round_to_zero(self) -> FixedU128<Frac>
Rounds to the next integer towards 0.
Note that for unsigned numbers, this is equivalent to floor
.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.1).round_to_zero(), Fix::from_num(2));
assert_eq!(Fix::from_num(2.9).round_to_zero(), Fix::from_num(2));
sourcepub fn ceil(self) -> FixedU128<Frac>
pub fn ceil(self) -> FixedU128<Frac>
Rounds to the next integer towards +∞.
Panics
When debug assertions are enabled, panics if the result does not fit.
When debug assertions are not enabled, the wrapped result can be
returned, but it is not considered a breaking change if in the future
it panics; if wrapping is required use wrapping_ceil
instead.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).ceil(), Fix::from_num(3));
sourcepub fn floor(self) -> FixedU128<Frac>
pub fn floor(self) -> FixedU128<Frac>
Rounds to the next integer towards −∞.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).floor(), Fix::from_num(2));
sourcepub fn round(self) -> FixedU128<Frac>
pub fn round(self) -> FixedU128<Frac>
Rounds to the nearest integer, with ties rounded away from zero.
Panics
When debug assertions are enabled, panics if the result does not fit.
When debug assertions are not enabled, the wrapped result can be
returned, but it is not considered a breaking change if in the future
it panics; if wrapping is required use wrapping_round
instead.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).round(), Fix::from_num(3));
sourcepub fn round_ties_to_even(self) -> FixedU128<Frac>
pub fn round_ties_to_even(self) -> FixedU128<Frac>
Rounds to the nearest integer, with ties rounded to even.
Panics
When debug assertions are enabled, panics if the result does not fit.
When debug assertions are not enabled, the wrapped result can be
returned, but it is not considered a breaking change if in the future
it panics; if wrapping is required use wrapping_round_ties_to_even
instead.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).round_ties_to_even(), Fix::from_num(2));
assert_eq!(Fix::from_num(3.5).round_ties_to_even(), Fix::from_num(4));
sourcepub fn checked_ceil(self) -> Option<FixedU128<Frac>>
pub fn checked_ceil(self) -> Option<FixedU128<Frac>>
sourcepub fn checked_floor(self) -> Option<FixedU128<Frac>>
pub fn checked_floor(self) -> Option<FixedU128<Frac>>
sourcepub fn checked_round(self) -> Option<FixedU128<Frac>>
pub fn checked_round(self) -> Option<FixedU128<Frac>>
Checked round. Rounds to the nearest integer, with ties
rounded away from zero, returning None
on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).checked_round(), Some(Fix::from_num(3)));
assert!(Fix::max_value().checked_round().is_none());
sourcepub fn checked_round_ties_to_even(self) -> Option<FixedU128<Frac>>
pub fn checked_round_ties_to_even(self) -> Option<FixedU128<Frac>>
Checked round. Rounds to the nearest integer, with ties
rounded to even, returning None
on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).checked_round_ties_to_even(), Some(Fix::from_num(2)));
assert_eq!(Fix::from_num(3.5).checked_round_ties_to_even(), Some(Fix::from_num(4)));
assert!(Fix::max_value().checked_round_ties_to_even().is_none());
sourcepub fn saturating_ceil(self) -> FixedU128<Frac>
pub fn saturating_ceil(self) -> FixedU128<Frac>
Saturating ceil. Rounds to the next integer towards +∞, saturating on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).saturating_ceil(), Fix::from_num(3));
assert_eq!(Fix::max_value().saturating_ceil(), Fix::max_value());
sourcepub fn saturating_floor(self) -> FixedU128<Frac>
pub fn saturating_floor(self) -> FixedU128<Frac>
Saturating floor. Rounds to the next integer towards −∞. Cannot overflow for unsigned values.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).saturating_floor(), Fix::from_num(2));
sourcepub fn saturating_round(self) -> FixedU128<Frac>
pub fn saturating_round(self) -> FixedU128<Frac>
Saturating round. Rounds to the nearest integer, with ties rounded away from zero, and saturating on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).saturating_round(), Fix::from_num(3));
assert_eq!(Fix::max_value().saturating_round(), Fix::max_value());
sourcepub fn saturating_round_ties_to_even(self) -> FixedU128<Frac>
pub fn saturating_round_ties_to_even(self) -> FixedU128<Frac>
Saturating round. Rounds to the nearest integer, with ties rounded to even, and saturating on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).saturating_round_ties_to_even(), Fix::from_num(2));
assert_eq!(Fix::from_num(3.5).saturating_round_ties_to_even(), Fix::from_num(4));
assert_eq!(Fix::max_value().saturating_round_ties_to_even(), Fix::max_value());
sourcepub fn wrapping_ceil(self) -> FixedU128<Frac>
pub fn wrapping_ceil(self) -> FixedU128<Frac>
Wrapping ceil. Rounds to the next integer towards +∞, wrapping on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).wrapping_ceil(), Fix::from_num(3));
assert_eq!(Fix::max_value().wrapping_ceil(), Fix::min_value());
sourcepub fn wrapping_floor(self) -> FixedU128<Frac>
pub fn wrapping_floor(self) -> FixedU128<Frac>
Wrapping floor. Rounds to the next integer towards −∞. Cannot overflow for unsigned values.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).wrapping_floor(), Fix::from_num(2));
sourcepub fn wrapping_round(self) -> FixedU128<Frac>
pub fn wrapping_round(self) -> FixedU128<Frac>
Wrapping round. Rounds to the next integer to the nearest, with ties rounded away from zero, and wrapping on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).wrapping_round(), Fix::from_num(3));
assert_eq!(Fix::max_value().wrapping_round(), Fix::min_value());
sourcepub fn wrapping_round_ties_to_even(self) -> FixedU128<Frac>
pub fn wrapping_round_ties_to_even(self) -> FixedU128<Frac>
Wrapping round. Rounds to the next integer to the nearest, with ties rounded to even, and wrapping on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).wrapping_round_ties_to_even(), Fix::from_num(2));
assert_eq!(Fix::from_num(3.5).wrapping_round_ties_to_even(), Fix::from_num(4));
assert_eq!(Fix::max_value().wrapping_round_ties_to_even(), Fix::min_value());
sourcepub fn overflowing_ceil(self) -> (FixedU128<Frac>, bool)
pub fn overflowing_ceil(self) -> (FixedU128<Frac>, bool)
Overflowing ceil. Rounds to the next integer towards +∞.
Returns a tuple of the fixed-point number and a bool
, indicating
whether an overflow has occurred. On overflow, the wrapped value is
returned.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).overflowing_ceil(), (Fix::from_num(3), false));
assert_eq!(Fix::max_value().overflowing_ceil(), (Fix::min_value(), true));
sourcepub fn overflowing_floor(self) -> (FixedU128<Frac>, bool)
pub fn overflowing_floor(self) -> (FixedU128<Frac>, bool)
sourcepub fn overflowing_round(self) -> (FixedU128<Frac>, bool)
pub fn overflowing_round(self) -> (FixedU128<Frac>, bool)
Overflowing round. Rounds to the next integer to the nearest, with ties rounded away from zero.
Returns a tuple of the fixed-point number and a bool
indicating
whether an overflow has occurred. On overflow, the wrapped value is
returned.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).overflowing_round(), (Fix::from_num(3), false));
assert_eq!(Fix::max_value().overflowing_round(), (Fix::min_value(), true));
sourcepub fn overflowing_round_ties_to_even(self) -> (FixedU128<Frac>, bool)
pub fn overflowing_round_ties_to_even(self) -> (FixedU128<Frac>, bool)
Overflowing round. Rounds to the next integer to the nearest, with ties rounded to even.
Returns a tuple of the fixed-point number and a bool
indicating
whether an overflow has occurred. On overflow, the wrapped value is
returned.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(2.5).overflowing_round_ties_to_even(), (Fix::from_num(2), false));
assert_eq!(Fix::from_num(3.5).overflowing_round_ties_to_even(), (Fix::from_num(4), false));
assert_eq!(Fix::max_value().overflowing_round_ties_to_even(), (Fix::min_value(), true));
sourcepub fn div_euclid(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
pub fn div_euclid(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
Euclidean division.
Panics
Panics if the divisor is zero.
When debug assertions are enabled, this method also panics if the
division overflows. When debug assertions are not enabled, the wrapped
value can be returned, but it is not considered a breaking change if
in the future it panics; if wrapping is required use
wrapping_div_euclid
instead.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(7.5).div_euclid(Fix::from_num(2)), Fix::from_num(3));
sourcepub fn div_euclid_int(self, rhs: u128) -> FixedU128<Frac>
pub fn div_euclid_int(self, rhs: u128) -> FixedU128<Frac>
sourcepub fn rem_euclid_int(self, rhs: u128) -> FixedU128<Frac>
pub fn rem_euclid_int(self, rhs: u128) -> FixedU128<Frac>
sourcepub fn checked_mul(self, rhs: FixedU128<Frac>) -> Option<FixedU128<Frac>>
pub fn checked_mul(self, rhs: FixedU128<Frac>) -> Option<FixedU128<Frac>>
Checked multiplication. Returns the product, or None
on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::max_value().checked_mul(Fix::from_num(1)), Some(Fix::max_value()));
assert_eq!(Fix::max_value().checked_mul(Fix::from_num(2)), None);
sourcepub fn checked_div(self, rhs: FixedU128<Frac>) -> Option<FixedU128<Frac>>
pub fn checked_div(self, rhs: FixedU128<Frac>) -> Option<FixedU128<Frac>>
Checked division. Returns the quotient, or None
if
the divisor is zero or on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::max_value().checked_div(Fix::from_num(1)), Some(Fix::max_value()));
assert_eq!(Fix::max_value().checked_div(Fix::from_num(1) / 2), None);
sourcepub fn checked_div_euclid(self, rhs: FixedU128<Frac>) -> Option<FixedU128<Frac>>
pub fn checked_div_euclid(self, rhs: FixedU128<Frac>) -> Option<FixedU128<Frac>>
Checked Euclidean division. Returns the quotient, or
None
if the divisor is zero or on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(7.5).checked_div_euclid(Fix::from_num(2)), Some(Fix::from_num(3)));
assert_eq!(Fix::from_num(7.5).checked_div_euclid(Fix::from_num(0)), None);
assert_eq!(Fix::max_value().checked_div_euclid(Fix::from_num(0.25)), None);
sourcepub fn checked_rem_int(self, rhs: u128) -> Option<FixedU128<Frac>>
pub fn checked_rem_int(self, rhs: u128) -> Option<FixedU128<Frac>>
Checked fixed-point remainder for division by an integer.
Returns the remainder, or None
if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(3.75).checked_rem_int(2), Some(Fix::from_num(1.75)));
assert_eq!(Fix::from_num(3.75).checked_rem_int(0), None);
sourcepub fn checked_div_euclid_int(self, rhs: u128) -> Option<FixedU128<Frac>>
pub fn checked_div_euclid_int(self, rhs: u128) -> Option<FixedU128<Frac>>
Checked Euclidean division by an integer. Returns the
quotient, or None
if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(7.5).checked_div_euclid_int(2), Some(Fix::from_num(3)));
assert_eq!(Fix::from_num(7.5).checked_div_euclid_int(0), None);
sourcepub fn checked_rem_euclid_int(self, rhs: u128) -> Option<FixedU128<Frac>>
pub fn checked_rem_euclid_int(self, rhs: u128) -> Option<FixedU128<Frac>>
Checked remainder for Euclidean division by an integer.
Returns the remainder, or None
if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U124, FixedU128};
type Fix = FixedU128<U124>;
assert_eq!(Fix::from_num(7.5).checked_rem_euclid_int(2), Some(Fix::from_num(1.5)));
assert_eq!(Fix::from_num(7.5).checked_rem_euclid_int(0), None);
sourcepub fn saturating_mul(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
pub fn saturating_mul(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
Saturating multiplication. Returns the product, saturating on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(3).saturating_mul(Fix::from_num(2)), Fix::from_num(6));
assert_eq!(Fix::max_value().saturating_mul(Fix::from_num(2)), Fix::max_value());
sourcepub fn saturating_div(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
pub fn saturating_div(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
Saturating division. Returns the quotient, saturating on overflow.
Panics
Panics if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let one_half = Fix::from_num(1) / 2;
assert_eq!(Fix::from_num(1).saturating_div(Fix::from_num(2)), one_half);
assert_eq!(Fix::max_value().saturating_div(one_half), Fix::max_value());
sourcepub fn saturating_div_euclid(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
pub fn saturating_div_euclid(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
Saturating Euclidean division. Returns the quotient, saturating on overflow.
Panics
Panics if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(7.5).saturating_div_euclid(Fix::from_num(2)), Fix::from_num(3));
assert_eq!(Fix::max_value().saturating_div_euclid(Fix::from_num(0.25)), Fix::max_value());
sourcepub fn wrapping_mul(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
pub fn wrapping_mul(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
Wrapping multiplication. Returns the product, wrapping on overflow.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(3).wrapping_mul(Fix::from_num(2)), Fix::from_num(6));
let wrapped = Fix::from_bits(!0 << 2);
assert_eq!(Fix::max_value().wrapping_mul(Fix::from_num(4)), wrapped);
sourcepub fn wrapping_div(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
pub fn wrapping_div(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
Wrapping division. Returns the quotient, wrapping on overflow.
Panics
Panics if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let one_point_5 = Fix::from_bits(0b11 << (4 - 1));
assert_eq!(Fix::from_num(3).wrapping_div(Fix::from_num(2)), one_point_5);
let quarter = Fix::from_num(1) / 4;
let wrapped = Fix::from_bits(!0 << 2);
assert_eq!(Fix::max_value().wrapping_div(quarter), wrapped);
sourcepub fn wrapping_div_euclid(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
pub fn wrapping_div_euclid(self, rhs: FixedU128<Frac>) -> FixedU128<Frac>
Wrapping Euclidean division. Returns the quotient, wrapping on overflow.
Panics
Panics if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(7.5).wrapping_div_euclid(Fix::from_num(2)), Fix::from_num(3));
let wrapped = Fix::max_value().wrapping_mul_int(4).round_to_zero();
assert_eq!(Fix::max_value().wrapping_div_euclid(Fix::from_num(0.25)), wrapped);
sourcepub fn wrapping_div_euclid_int(self, rhs: u128) -> FixedU128<Frac>
pub fn wrapping_div_euclid_int(self, rhs: u128) -> FixedU128<Frac>
Wrapping Euclidean division by an integer. Returns the quotient.
Can never overflow for unsigned values.
Panics
Panics if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(7.5).wrapping_div_euclid_int(2), Fix::from_num(3));
sourcepub fn wrapping_rem_euclid_int(self, rhs: u128) -> FixedU128<Frac>
pub fn wrapping_rem_euclid_int(self, rhs: u128) -> FixedU128<Frac>
Wrapping remainder for Euclidean division by an integer. Returns the remainder.
Can never overflow for unsigned values.
Panics
Panics if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U124, FixedU128};
type Fix = FixedU128<U124>;
assert_eq!(Fix::from_num(7.5).wrapping_rem_euclid_int(2), Fix::from_num(1.5));
sourcepub fn overflowing_mul(self, rhs: FixedU128<Frac>) -> (FixedU128<Frac>, bool)
pub fn overflowing_mul(self, rhs: FixedU128<Frac>) -> (FixedU128<Frac>, bool)
Overflowing multiplication.
Returns a tuple of the product and a bool
indicating whether an
overflow has occurred. On overflow, the wrapped value is returned.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(3).overflowing_mul(Fix::from_num(2)), (Fix::from_num(6), false));
let wrapped = Fix::from_bits(!0 << 2);
assert_eq!(Fix::max_value().overflowing_mul(Fix::from_num(4)), (wrapped, true));
sourcepub fn overflowing_div(self, rhs: FixedU128<Frac>) -> (FixedU128<Frac>, bool)
pub fn overflowing_div(self, rhs: FixedU128<Frac>) -> (FixedU128<Frac>, bool)
Overflowing division.
Returns a tuple of the quotient and a bool
indicating whether an
overflow has occurred. On overflow, the wrapped value is returned.
Panics
Panics if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let one_point_5 = Fix::from_bits(0b11 << (4 - 1));
assert_eq!(Fix::from_num(3).overflowing_div(Fix::from_num(2)), (one_point_5, false));
let quarter = Fix::from_num(1) / 4;
let wrapped = Fix::from_bits(!0 << 2);
assert_eq!(Fix::max_value().overflowing_div(quarter), (wrapped, true));
sourcepub fn overflowing_div_euclid(
self,
rhs: FixedU128<Frac>
) -> (FixedU128<Frac>, bool)
pub fn overflowing_div_euclid( self, rhs: FixedU128<Frac> ) -> (FixedU128<Frac>, bool)
Overflowing Euclidean division.
Returns a tuple of the quotient and a bool
indicating whether an
overflow has occurred. On overflow, the wrapped value is returned.
Panics
Panics if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
let check = Fix::from_num(3);
assert_eq!(Fix::from_num(7.5).overflowing_div_euclid(Fix::from_num(2)), (check, false));
let wrapped = Fix::max_value().wrapping_mul_int(4).round_to_zero();
assert_eq!(Fix::max_value().overflowing_div_euclid(Fix::from_num(0.25)), (wrapped, true));
sourcepub fn overflowing_div_euclid_int(self, rhs: u128) -> (FixedU128<Frac>, bool)
pub fn overflowing_div_euclid_int(self, rhs: u128) -> (FixedU128<Frac>, bool)
Overflowing Euclidean division by an integer.
Returns a tuple of the quotient and false
, as the division can never overflow for unsigned values.
Panics
Panics if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U4, FixedU128};
type Fix = FixedU128<U4>;
assert_eq!(Fix::from_num(7.5).overflowing_div_euclid_int(2), (Fix::from_num(3), false));
sourcepub fn overflowing_rem_euclid_int(self, rhs: u128) -> (FixedU128<Frac>, bool)
pub fn overflowing_rem_euclid_int(self, rhs: u128) -> (FixedU128<Frac>, bool)
Remainder for Euclidean division by an integer.
Returns a tuple of the remainder and false
, as this can never overflow for unsigned values.
Panics
Panics if the divisor is zero.
Examples
use substrate_fixed::{types::extra::U124, FixedU128};
type Fix = FixedU128<U124>;
assert_eq!(Fix::from_num(7.5).overflowing_rem_euclid_int(2), (Fix::from_num(1.5), false));
sourcepub fn wrapping_rem_int(self, rhs: u128) -> FixedU128<Frac>
👎Deprecated since 0.5.3: cannot overflow, use %
or Rem::rem
instead
pub fn wrapping_rem_int(self, rhs: u128) -> FixedU128<Frac>
%
or Rem::rem
insteadTrait Implementations§
source§impl<'a, Frac> AddAssign<&'a FixedU128<Frac>> for FixedU128<Frac>
impl<'a, Frac> AddAssign<&'a FixedU128<Frac>> for FixedU128<Frac>
source§fn add_assign(&mut self, rhs: &FixedU128<Frac>)
fn add_assign(&mut self, rhs: &FixedU128<Frac>)
+=
operation. Read moresource§impl<Frac> AddAssign for FixedU128<Frac>
impl<Frac> AddAssign for FixedU128<Frac>
source§fn add_assign(&mut self, rhs: FixedU128<Frac>)
fn add_assign(&mut self, rhs: FixedU128<Frac>)
+=
operation. Read moresource§impl<'a, Frac> BitAndAssign<&'a FixedU128<Frac>> for FixedU128<Frac>
impl<'a, Frac> BitAndAssign<&'a FixedU128<Frac>> for FixedU128<Frac>
source§fn bitand_assign(&mut self, rhs: &FixedU128<Frac>)
fn bitand_assign(&mut self, rhs: &FixedU128<Frac>)
&=
operation. Read moresource§impl<Frac> BitAndAssign for FixedU128<Frac>
impl<Frac> BitAndAssign for FixedU128<Frac>
source§fn bitand_assign(&mut self, rhs: FixedU128<Frac>)
fn bitand_assign(&mut self, rhs: FixedU128<Frac>)
&=
operation. Read moresource§impl<'a, Frac> BitOrAssign<&'a FixedU128<Frac>> for FixedU128<Frac>
impl<'a, Frac> BitOrAssign<&'a FixedU128<Frac>> for FixedU128<Frac>
source§fn bitor_assign(&mut self, rhs: &FixedU128<Frac>)
fn bitor_assign(&mut self, rhs: &FixedU128<Frac>)
|=
operation. Read moresource§impl<Frac> BitOrAssign for FixedU128<Frac>
impl<Frac> BitOrAssign for FixedU128<Frac>
source§fn bitor_assign(&mut self, rhs: FixedU128<Frac>)
fn bitor_assign(&mut self, rhs: FixedU128<Frac>)
|=
operation. Read moresource§impl<'a, Frac> BitXorAssign<&'a FixedU128<Frac>> for FixedU128<Frac>
impl<'a, Frac> BitXorAssign<&'a FixedU128<Frac>> for FixedU128<Frac>
source§fn bitxor_assign(&mut self, rhs: &FixedU128<Frac>)
fn bitxor_assign(&mut self, rhs: &FixedU128<Frac>)
^=
operation. Read moresource§impl<Frac> BitXorAssign for FixedU128<Frac>
impl<Frac> BitXorAssign for FixedU128<Frac>
source§fn bitxor_assign(&mut self, rhs: FixedU128<Frac>)
fn bitxor_assign(&mut self, rhs: FixedU128<Frac>)
^=
operation. Read moresource§impl<FracSrc: LeEqU128, FracDst: LeEqU128> CheckedCast<FixedI128<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU128> CheckedCast<FixedI128<FracDst>> for FixedU128<FracSrc>
source§fn checked_cast(self) -> Option<FixedI128<FracDst>>
fn checked_cast(self) -> Option<FixedI128<FracDst>>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU16> CheckedCast<FixedI16<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU16> CheckedCast<FixedI16<FracDst>> for FixedU128<FracSrc>
source§fn checked_cast(self) -> Option<FixedI16<FracDst>>
fn checked_cast(self) -> Option<FixedI16<FracDst>>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU32> CheckedCast<FixedI32<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU32> CheckedCast<FixedI32<FracDst>> for FixedU128<FracSrc>
source§fn checked_cast(self) -> Option<FixedI32<FracDst>>
fn checked_cast(self) -> Option<FixedI32<FracDst>>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU64> CheckedCast<FixedI64<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU64> CheckedCast<FixedI64<FracDst>> for FixedU128<FracSrc>
source§fn checked_cast(self) -> Option<FixedI64<FracDst>>
fn checked_cast(self) -> Option<FixedI64<FracDst>>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU8> CheckedCast<FixedI8<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU8> CheckedCast<FixedI8<FracDst>> for FixedU128<FracSrc>
source§fn checked_cast(self) -> Option<FixedI8<FracDst>>
fn checked_cast(self) -> Option<FixedI8<FracDst>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for bf16
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for bf16
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for bool
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for bool
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for f16
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for f16
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for f32
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for f32
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for f64
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for f64
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for i128
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for i128
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for i16
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for i16
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for i32
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for i32
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for i64
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for i64
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for i8
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for i8
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for isize
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for isize
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for u128
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for u128
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for u16
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for u16
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for u32
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for u32
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for u64
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for u64
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for u8
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for u8
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for usize
impl<Frac: LeEqU128> CheckedCast<FixedU128<Frac>> for usize
source§fn checked_cast(self) -> Option<FixedU128<Frac>>
fn checked_cast(self) -> Option<FixedU128<Frac>>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedI128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedI128<FracSrc>
source§fn checked_cast(self) -> Option<FixedU128<FracDst>>
fn checked_cast(self) -> Option<FixedU128<FracDst>>
source§impl<FracSrc: LeEqU16, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedI16<FracSrc>
impl<FracSrc: LeEqU16, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedI16<FracSrc>
source§fn checked_cast(self) -> Option<FixedU128<FracDst>>
fn checked_cast(self) -> Option<FixedU128<FracDst>>
source§impl<FracSrc: LeEqU32, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedI32<FracSrc>
impl<FracSrc: LeEqU32, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedI32<FracSrc>
source§fn checked_cast(self) -> Option<FixedU128<FracDst>>
fn checked_cast(self) -> Option<FixedU128<FracDst>>
source§impl<FracSrc: LeEqU64, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedI64<FracSrc>
impl<FracSrc: LeEqU64, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedI64<FracSrc>
source§fn checked_cast(self) -> Option<FixedU128<FracDst>>
fn checked_cast(self) -> Option<FixedU128<FracDst>>
source§impl<FracSrc: LeEqU8, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedI8<FracSrc>
impl<FracSrc: LeEqU8, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedI8<FracSrc>
source§fn checked_cast(self) -> Option<FixedU128<FracDst>>
fn checked_cast(self) -> Option<FixedU128<FracDst>>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedU128<FracSrc>
source§fn checked_cast(self) -> Option<FixedU128<FracDst>>
fn checked_cast(self) -> Option<FixedU128<FracDst>>
source§impl<FracSrc: LeEqU16, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedU16<FracSrc>
impl<FracSrc: LeEqU16, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedU16<FracSrc>
source§fn checked_cast(self) -> Option<FixedU128<FracDst>>
fn checked_cast(self) -> Option<FixedU128<FracDst>>
source§impl<FracSrc: LeEqU32, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedU32<FracSrc>
impl<FracSrc: LeEqU32, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedU32<FracSrc>
source§fn checked_cast(self) -> Option<FixedU128<FracDst>>
fn checked_cast(self) -> Option<FixedU128<FracDst>>
source§impl<FracSrc: LeEqU64, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedU64<FracSrc>
impl<FracSrc: LeEqU64, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedU64<FracSrc>
source§fn checked_cast(self) -> Option<FixedU128<FracDst>>
fn checked_cast(self) -> Option<FixedU128<FracDst>>
source§impl<FracSrc: LeEqU8, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedU8<FracSrc>
impl<FracSrc: LeEqU8, FracDst: LeEqU128> CheckedCast<FixedU128<FracDst>> for FixedU8<FracSrc>
source§fn checked_cast(self) -> Option<FixedU128<FracDst>>
fn checked_cast(self) -> Option<FixedU128<FracDst>>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU16> CheckedCast<FixedU16<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU16> CheckedCast<FixedU16<FracDst>> for FixedU128<FracSrc>
source§fn checked_cast(self) -> Option<FixedU16<FracDst>>
fn checked_cast(self) -> Option<FixedU16<FracDst>>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU32> CheckedCast<FixedU32<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU32> CheckedCast<FixedU32<FracDst>> for FixedU128<FracSrc>
source§fn checked_cast(self) -> Option<FixedU32<FracDst>>
fn checked_cast(self) -> Option<FixedU32<FracDst>>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU64> CheckedCast<FixedU64<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU64> CheckedCast<FixedU64<FracDst>> for FixedU128<FracSrc>
source§fn checked_cast(self) -> Option<FixedU64<FracDst>>
fn checked_cast(self) -> Option<FixedU64<FracDst>>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU8> CheckedCast<FixedU8<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU8> CheckedCast<FixedU8<FracDst>> for FixedU128<FracSrc>
source§fn checked_cast(self) -> Option<FixedU8<FracDst>>
fn checked_cast(self) -> Option<FixedU8<FracDst>>
source§impl<Frac: LeEqU128> CheckedCast<bf16> for FixedU128<Frac>
impl<Frac: LeEqU128> CheckedCast<bf16> for FixedU128<Frac>
source§fn checked_cast(self) -> Option<bf16>
fn checked_cast(self) -> Option<bf16>
source§impl<Frac: LeEqU128> CheckedCast<f16> for FixedU128<Frac>
impl<Frac: LeEqU128> CheckedCast<f16> for FixedU128<Frac>
source§fn checked_cast(self) -> Option<f16>
fn checked_cast(self) -> Option<f16>
source§impl<Frac: LeEqU128> CheckedCast<f32> for FixedU128<Frac>
impl<Frac: LeEqU128> CheckedCast<f32> for FixedU128<Frac>
source§fn checked_cast(self) -> Option<f32>
fn checked_cast(self) -> Option<f32>
source§impl<Frac: LeEqU128> CheckedCast<f64> for FixedU128<Frac>
impl<Frac: LeEqU128> CheckedCast<f64> for FixedU128<Frac>
source§fn checked_cast(self) -> Option<f64>
fn checked_cast(self) -> Option<f64>
source§impl<Frac: LeEqU128> CheckedCast<i128> for FixedU128<Frac>
impl<Frac: LeEqU128> CheckedCast<i128> for FixedU128<Frac>
source§fn checked_cast(self) -> Option<i128>
fn checked_cast(self) -> Option<i128>
source§impl<Frac: LeEqU128> CheckedCast<i16> for FixedU128<Frac>
impl<Frac: LeEqU128> CheckedCast<i16> for FixedU128<Frac>
source§fn checked_cast(self) -> Option<i16>
fn checked_cast(self) -> Option<i16>
source§impl<Frac: LeEqU128> CheckedCast<i32> for FixedU128<Frac>
impl<Frac: LeEqU128> CheckedCast<i32> for FixedU128<Frac>
source§fn checked_cast(self) -> Option<i32>
fn checked_cast(self) -> Option<i32>
source§impl<Frac: LeEqU128> CheckedCast<i64> for FixedU128<Frac>
impl<Frac: LeEqU128> CheckedCast<i64> for FixedU128<Frac>
source§fn checked_cast(self) -> Option<i64>
fn checked_cast(self) -> Option<i64>
source§impl<Frac: LeEqU128> CheckedCast<i8> for FixedU128<Frac>
impl<Frac: LeEqU128> CheckedCast<i8> for FixedU128<Frac>
source§fn checked_cast(self) -> Option<i8>
fn checked_cast(self) -> Option<i8>
source§impl<Frac: LeEqU128> CheckedCast<isize> for FixedU128<Frac>
impl<Frac: LeEqU128> CheckedCast<isize> for FixedU128<Frac>
source§fn checked_cast(self) -> Option<isize>
fn checked_cast(self) -> Option<isize>
source§impl<Frac: LeEqU128> CheckedCast<u128> for FixedU128<Frac>
impl<Frac: LeEqU128> CheckedCast<u128> for FixedU128<Frac>
source§fn checked_cast(self) -> Option<u128>
fn checked_cast(self) -> Option<u128>
source§impl<Frac: LeEqU128> CheckedCast<u16> for FixedU128<Frac>
impl<Frac: LeEqU128> CheckedCast<u16> for FixedU128<Frac>
source§fn checked_cast(self) -> Option<u16>
fn checked_cast(self) -> Option<u16>
source§impl<Frac: LeEqU128> CheckedCast<u32> for FixedU128<Frac>
impl<Frac: LeEqU128> CheckedCast<u32> for FixedU128<Frac>
source§fn checked_cast(self) -> Option<u32>
fn checked_cast(self) -> Option<u32>
source§impl<Frac: LeEqU128> CheckedCast<u64> for FixedU128<Frac>
impl<Frac: LeEqU128> CheckedCast<u64> for FixedU128<Frac>
source§fn checked_cast(self) -> Option<u64>
fn checked_cast(self) -> Option<u64>
source§impl<Frac: LeEqU128> CheckedCast<u8> for FixedU128<Frac>
impl<Frac: LeEqU128> CheckedCast<u8> for FixedU128<Frac>
source§fn checked_cast(self) -> Option<u8>
fn checked_cast(self) -> Option<u8>
source§impl<Frac: LeEqU128> CheckedCast<usize> for FixedU128<Frac>
impl<Frac: LeEqU128> CheckedCast<usize> for FixedU128<Frac>
source§fn checked_cast(self) -> Option<usize>
fn checked_cast(self) -> Option<usize>
source§impl<Frac> Decode for FixedU128<Frac>where
PhantomData<Frac>: Decode,
impl<Frac> Decode for FixedU128<Frac>where PhantomData<Frac>: Decode,
source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy ) -> Result<Self, Error>
source§fn decode_into<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
dst_: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>
fn decode_into<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, dst_: &mut MaybeUninit<Self> ) -> Result<DecodeFinished, Error>
source§impl<'de, Frac: LeEqU128> Deserialize<'de> for FixedU128<Frac>
impl<'de, Frac: LeEqU128> Deserialize<'de> for FixedU128<Frac>
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
source§impl<'a, Frac: LeEqU128> DivAssign<&'a FixedU128<Frac>> for FixedU128<Frac>
impl<'a, Frac: LeEqU128> DivAssign<&'a FixedU128<Frac>> for FixedU128<Frac>
source§fn div_assign(&mut self, rhs: &FixedU128<Frac>)
fn div_assign(&mut self, rhs: &FixedU128<Frac>)
/=
operation. Read moresource§impl<'a, Frac: LeEqU128> DivAssign<&'a u128> for FixedU128<Frac>
impl<'a, Frac: LeEqU128> DivAssign<&'a u128> for FixedU128<Frac>
source§fn div_assign(&mut self, rhs: &u128)
fn div_assign(&mut self, rhs: &u128)
/=
operation. Read moresource§impl<Frac: LeEqU128> DivAssign<u128> for FixedU128<Frac>
impl<Frac: LeEqU128> DivAssign<u128> for FixedU128<Frac>
source§fn div_assign(&mut self, rhs: u128)
fn div_assign(&mut self, rhs: u128)
/=
operation. Read moresource§impl<Frac: LeEqU128> DivAssign for FixedU128<Frac>
impl<Frac: LeEqU128> DivAssign for FixedU128<Frac>
source§fn div_assign(&mut self, rhs: FixedU128<Frac>)
fn div_assign(&mut self, rhs: FixedU128<Frac>)
/=
operation. Read moresource§impl<Frac> Encode for FixedU128<Frac>where
PhantomData<Frac>: Encode,
impl<Frac> Encode for FixedU128<Frac>where PhantomData<Frac>: Encode,
source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy )
source§fn using_encoded<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&[u8]) -> R,
fn using_encoded<R, F>(&self, f: F) -> Rwhere F: FnOnce(&[u8]) -> R,
source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
source§impl<Frac: LeEqU128> Fixed for FixedU128<Frac>
impl<Frac: LeEqU128> Fixed for FixedU128<Frac>
source§fn frac_nbits() -> u32
fn frac_nbits() -> u32
source§fn from_bits(bits: Self::Bits) -> Self
fn from_bits(bits: Self::Bits) -> Self
source§fn to_bits(self) -> Self::Bits
fn to_bits(self) -> Self::Bits
source§fn from_be_bytes(bits: Self::Bytes) -> Self
fn from_be_bytes(bits: Self::Bytes) -> Self
source§fn from_le_bytes(bits: Self::Bytes) -> Self
fn from_le_bytes(bits: Self::Bytes) -> Self
source§fn from_ne_bytes(bits: Self::Bytes) -> Self
fn from_ne_bytes(bits: Self::Bytes) -> Self
source§fn to_be_bytes(self) -> Self::Bytes
fn to_be_bytes(self) -> Self::Bytes
source§fn to_le_bytes(self) -> Self::Bytes
fn to_le_bytes(self) -> Self::Bytes
source§fn to_ne_bytes(self) -> Self::Bytes
fn to_ne_bytes(self) -> Self::Bytes
source§fn from_num<Src: ToFixed>(src: Src) -> Self
fn from_num<Src: ToFixed>(src: Src) -> Self
source§fn to_num<Dst: FromFixed>(self) -> Dst
fn to_num<Dst: FromFixed>(self) -> Dst
source§fn checked_from_num<Src: ToFixed>(val: Src) -> Option<Self>
fn checked_from_num<Src: ToFixed>(val: Src) -> Option<Self>
source§fn checked_to_num<Dst: FromFixed>(self) -> Option<Dst>
fn checked_to_num<Dst: FromFixed>(self) -> Option<Dst>
source§fn saturating_from_num<Src: ToFixed>(val: Src) -> Self
fn saturating_from_num<Src: ToFixed>(val: Src) -> Self
source§fn saturating_to_num<Dst: FromFixed>(self) -> Dst
fn saturating_to_num<Dst: FromFixed>(self) -> Dst
source§fn wrapping_from_num<Src: ToFixed>(val: Src) -> Self
fn wrapping_from_num<Src: ToFixed>(val: Src) -> Self
source§fn wrapping_to_num<Dst: FromFixed>(self) -> Dst
fn wrapping_to_num<Dst: FromFixed>(self) -> Dst
source§fn overflowing_from_num<Src: ToFixed>(val: Src) -> (Self, bool)
fn overflowing_from_num<Src: ToFixed>(val: Src) -> (Self, bool)
source§fn overflowing_to_num<Dst: FromFixed>(self) -> (Dst, bool)
fn overflowing_to_num<Dst: FromFixed>(self) -> (Dst, bool)
source§fn from_str_binary(src: &str) -> Result<Self, ParseFixedError>
fn from_str_binary(src: &str) -> Result<Self, ParseFixedError>
source§fn from_str_octal(src: &str) -> Result<Self, ParseFixedError>
fn from_str_octal(src: &str) -> Result<Self, ParseFixedError>
source§fn from_str_hex(src: &str) -> Result<Self, ParseFixedError>
fn from_str_hex(src: &str) -> Result<Self, ParseFixedError>
source§fn saturating_from_str(src: &str) -> Result<Self, ParseFixedError>
fn saturating_from_str(src: &str) -> Result<Self, ParseFixedError>
source§fn saturating_from_str_binary(src: &str) -> Result<Self, ParseFixedError>
fn saturating_from_str_binary(src: &str) -> Result<Self, ParseFixedError>
source§fn saturating_from_str_octal(src: &str) -> Result<Self, ParseFixedError>
fn saturating_from_str_octal(src: &str) -> Result<Self, ParseFixedError>
source§fn saturating_from_str_hex(src: &str) -> Result<Self, ParseFixedError>
fn saturating_from_str_hex(src: &str) -> Result<Self, ParseFixedError>
source§fn wrapping_from_str(src: &str) -> Result<Self, ParseFixedError>
fn wrapping_from_str(src: &str) -> Result<Self, ParseFixedError>
source§fn wrapping_from_str_binary(src: &str) -> Result<Self, ParseFixedError>
fn wrapping_from_str_binary(src: &str) -> Result<Self, ParseFixedError>
source§fn wrapping_from_str_octal(src: &str) -> Result<Self, ParseFixedError>
fn wrapping_from_str_octal(src: &str) -> Result<Self, ParseFixedError>
source§fn wrapping_from_str_hex(src: &str) -> Result<Self, ParseFixedError>
fn wrapping_from_str_hex(src: &str) -> Result<Self, ParseFixedError>
source§fn overflowing_from_str(src: &str) -> Result<(Self, bool), ParseFixedError>
fn overflowing_from_str(src: &str) -> Result<(Self, bool), ParseFixedError>
source§fn overflowing_from_str_binary(
src: &str
) -> Result<(Self, bool), ParseFixedError>
fn overflowing_from_str_binary( src: &str ) -> Result<(Self, bool), ParseFixedError>
source§fn overflowing_from_str_octal(
src: &str
) -> Result<(Self, bool), ParseFixedError>
fn overflowing_from_str_octal( src: &str ) -> Result<(Self, bool), ParseFixedError>
source§fn overflowing_from_str_hex(src: &str) -> Result<(Self, bool), ParseFixedError>
fn overflowing_from_str_hex(src: &str) -> Result<(Self, bool), ParseFixedError>
source§fn round_to_zero(self) -> Self
fn round_to_zero(self) -> Self
source§fn round_ties_to_even(self) -> Self
fn round_ties_to_even(self) -> Self
source§fn checked_ceil(self) -> Option<Self>
fn checked_ceil(self) -> Option<Self>
None
on overflow.source§fn checked_floor(self) -> Option<Self>
fn checked_floor(self) -> Option<Self>
None
on overflow.source§fn checked_round(self) -> Option<Self>
fn checked_round(self) -> Option<Self>
None
on overflow.source§fn checked_round_ties_to_even(self) -> Option<Self>
fn checked_round_ties_to_even(self) -> Option<Self>
None
on overflow.source§fn saturating_ceil(self) -> Self
fn saturating_ceil(self) -> Self
source§fn saturating_floor(self) -> Self
fn saturating_floor(self) -> Self
source§fn saturating_round(self) -> Self
fn saturating_round(self) -> Self
source§fn saturating_round_ties_to_even(self) -> Self
fn saturating_round_ties_to_even(self) -> Self
source§fn wrapping_ceil(self) -> Self
fn wrapping_ceil(self) -> Self
source§fn wrapping_floor(self) -> Self
fn wrapping_floor(self) -> Self
source§fn wrapping_round(self) -> Self
fn wrapping_round(self) -> Self
source§fn wrapping_round_ties_to_even(self) -> Self
fn wrapping_round_ties_to_even(self) -> Self
source§fn overflowing_ceil(self) -> (Self, bool)
fn overflowing_ceil(self) -> (Self, bool)
source§fn overflowing_floor(self) -> (Self, bool)
fn overflowing_floor(self) -> (Self, bool)
source§fn overflowing_round(self) -> (Self, bool)
fn overflowing_round(self) -> (Self, bool)
source§fn overflowing_round_ties_to_even(self) -> (Self, bool)
fn overflowing_round_ties_to_even(self) -> (Self, bool)
source§fn count_ones(self) -> u32
fn count_ones(self) -> u32
source§fn count_zeros(self) -> u32
fn count_zeros(self) -> u32
source§fn leading_zeros(self) -> u32
fn leading_zeros(self) -> u32
source§fn trailing_zeros(self) -> u32
fn trailing_zeros(self) -> u32
source§fn rotate_left(self, n: u32) -> Self
fn rotate_left(self, n: u32) -> Self
n
bits, wrapping the truncated bits to the right end.source§fn rotate_right(self, n: u32) -> Self
fn rotate_right(self, n: u32) -> Self
n
bits, wrapping the truncated bits to the left end.source§fn div_euclid(self, rhs: Self) -> Self
fn div_euclid(self, rhs: Self) -> Self
source§fn rem_euclid(self, rhs: Self) -> Self
fn rem_euclid(self, rhs: Self) -> Self
source§fn div_euclid_int(self, rhs: Self::Bits) -> Self
fn div_euclid_int(self, rhs: Self::Bits) -> Self
source§fn rem_euclid_int(self, rhs: Self::Bits) -> Self
fn rem_euclid_int(self, rhs: Self::Bits) -> Self
source§fn checked_neg(self) -> Option<Self>
fn checked_neg(self) -> Option<Self>
None
on overflow.source§fn checked_add(self, rhs: Self) -> Option<Self>
fn checked_add(self, rhs: Self) -> Option<Self>
None
on overflow.source§fn checked_sub(self, rhs: Self) -> Option<Self>
fn checked_sub(self, rhs: Self) -> Option<Self>
None
on overflow.source§fn checked_mul(self, rhs: Self) -> Option<Self>
fn checked_mul(self, rhs: Self) -> Option<Self>
None
on overflow.source§fn checked_div(self, rhs: Self) -> Option<Self>
fn checked_div(self, rhs: Self) -> Option<Self>
None
if the
divisor is zero or on overflow.source§fn checked_rem(self, rhs: Self) -> Option<Self>
fn checked_rem(self, rhs: Self) -> Option<Self>
None
if the
divisor is zero.source§fn checked_div_euclid(self, rhs: Self) -> Option<Self>
fn checked_div_euclid(self, rhs: Self) -> Option<Self>
None
if the divisor is zero or the division
results in overflow.source§fn checked_rem_euclid(self, rhs: Self) -> Option<Self>
fn checked_rem_euclid(self, rhs: Self) -> Option<Self>
None
if the divisor is zero.source§fn checked_mul_int(self, rhs: Self::Bits) -> Option<Self>
fn checked_mul_int(self, rhs: Self::Bits) -> Option<Self>
None
on overflow.source§fn checked_div_int(self, rhs: Self::Bits) -> Option<Self>
fn checked_div_int(self, rhs: Self::Bits) -> Option<Self>
None
if the divisor is zero or if the division results in
overflow.source§fn checked_rem_int(self, rhs: Self::Bits) -> Option<Self>
fn checked_rem_int(self, rhs: Self::Bits) -> Option<Self>
None
if the divisor is zero or
if the division results in overflow.source§fn checked_div_euclid_int(self, rhs: Self::Bits) -> Option<Self>
fn checked_div_euclid_int(self, rhs: Self::Bits) -> Option<Self>
None
if the divisor is zero or if the
division results in overflow.source§fn checked_rem_euclid_int(self, rhs: Self::Bits) -> Option<Self>
fn checked_rem_euclid_int(self, rhs: Self::Bits) -> Option<Self>
None
if the divisor is zero or
if the remainder results in overflow.source§fn checked_shl(self, rhs: u32) -> Option<Self>
fn checked_shl(self, rhs: u32) -> Option<Self>
None
if
rhs
≥ the number of bits.source§fn checked_shr(self, rhs: u32) -> Option<Self>
fn checked_shr(self, rhs: u32) -> Option<Self>
None
if rhs
≥ the number of bits.source§fn saturating_neg(self) -> Self
fn saturating_neg(self) -> Self
source§fn saturating_add(self, rhs: Self) -> Self
fn saturating_add(self, rhs: Self) -> Self
source§fn saturating_sub(self, rhs: Self) -> Self
fn saturating_sub(self, rhs: Self) -> Self
source§fn saturating_mul(self, rhs: Self) -> Self
fn saturating_mul(self, rhs: Self) -> Self
source§fn saturating_div(self, rhs: Self) -> Self
fn saturating_div(self, rhs: Self) -> Self
source§fn saturating_div_euclid(self, rhs: Self) -> Self
fn saturating_div_euclid(self, rhs: Self) -> Self
source§fn saturating_mul_int(self, rhs: Self::Bits) -> Self
fn saturating_mul_int(self, rhs: Self::Bits) -> Self
source§fn wrapping_neg(self) -> Self
fn wrapping_neg(self) -> Self
source§fn wrapping_add(self, rhs: Self) -> Self
fn wrapping_add(self, rhs: Self) -> Self
source§fn wrapping_sub(self, rhs: Self) -> Self
fn wrapping_sub(self, rhs: Self) -> Self
source§fn wrapping_mul(self, rhs: Self) -> Self
fn wrapping_mul(self, rhs: Self) -> Self
source§fn wrapping_div(self, rhs: Self) -> Self
fn wrapping_div(self, rhs: Self) -> Self
source§fn wrapping_div_euclid(self, rhs: Self) -> Self
fn wrapping_div_euclid(self, rhs: Self) -> Self
source§fn wrapping_mul_int(self, rhs: Self::Bits) -> Self
fn wrapping_mul_int(self, rhs: Self::Bits) -> Self
source§fn wrapping_div_int(self, rhs: Self::Bits) -> Self
fn wrapping_div_int(self, rhs: Self::Bits) -> Self
source§fn wrapping_div_euclid_int(self, rhs: Self::Bits) -> Self
fn wrapping_div_euclid_int(self, rhs: Self::Bits) -> Self
source§fn wrapping_rem_euclid_int(self, rhs: Self::Bits) -> Self
fn wrapping_rem_euclid_int(self, rhs: Self::Bits) -> Self
source§fn wrapping_shl(self, rhs: u32) -> Self
fn wrapping_shl(self, rhs: u32) -> Self
rhs
if rhs
≥ the number of
bits, then shifts and returns the number.source§fn wrapping_shr(self, rhs: u32) -> Self
fn wrapping_shr(self, rhs: u32) -> Self
rhs
if rhs
≥ the number of
bits, then shifts and returns the number.source§fn overflowing_neg(self) -> (Self, bool)
fn overflowing_neg(self) -> (Self, bool)
source§fn overflowing_add(self, rhs: Self) -> (Self, bool)
fn overflowing_add(self, rhs: Self) -> (Self, bool)
source§fn overflowing_sub(self, rhs: Self) -> (Self, bool)
fn overflowing_sub(self, rhs: Self) -> (Self, bool)
source§fn overflowing_mul(self, rhs: Self) -> (Self, bool)
fn overflowing_mul(self, rhs: Self) -> (Self, bool)
source§fn overflowing_div(self, rhs: Self) -> (Self, bool)
fn overflowing_div(self, rhs: Self) -> (Self, bool)
source§fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool)
fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool)
source§fn overflowing_mul_int(self, rhs: Self::Bits) -> (Self, bool)
fn overflowing_mul_int(self, rhs: Self::Bits) -> (Self, bool)
source§fn overflowing_div_int(self, rhs: Self::Bits) -> (Self, bool)
fn overflowing_div_int(self, rhs: Self::Bits) -> (Self, bool)
source§fn overflowing_div_euclid_int(self, rhs: Self::Bits) -> (Self, bool)
fn overflowing_div_euclid_int(self, rhs: Self::Bits) -> (Self, bool)
source§fn overflowing_rem_euclid_int(self, rhs: Self::Bits) -> (Self, bool)
fn overflowing_rem_euclid_int(self, rhs: Self::Bits) -> (Self, bool)
source§fn wrapping_rem_int(self, rhs: Self::Bits) -> Self
fn wrapping_rem_int(self, rhs: Self::Bits) -> Self
%
or Rem::rem
insteadsource§impl<Frac: LeEqU128> FixedUnsigned for FixedU128<Frac>
impl<Frac: LeEqU128> FixedUnsigned for FixedU128<Frac>
source§fn is_power_of_two(self) -> bool
fn is_power_of_two(self) -> bool
true
if the fixed-point number is
2k for some integer k.source§fn next_power_of_two(self) -> Self
fn next_power_of_two(self) -> Self
self
.source§fn checked_next_power_of_two(self) -> Option<Self>
fn checked_next_power_of_two(self) -> Option<Self>
self
, or None
if the
next power of two is too large to represent.source§impl<FracSrc, FracDst: LeEqU128> From<FixedU16<FracSrc>> for FixedU128<FracDst>where
FracSrc: IsLessOrEqual<FracDst, Output = True> + LeEqU16,
U16: Sub<FracSrc>,
U128: Sub<FracDst>,
Diff<U16, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracSrc, FracDst: LeEqU128> From<FixedU16<FracSrc>> for FixedU128<FracDst>where FracSrc: IsLessOrEqual<FracDst, Output = True> + LeEqU16, U16: Sub<FracSrc>, U128: Sub<FracDst>, Diff<U16, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§impl<FracSrc, FracDst: LeEqU128> From<FixedU32<FracSrc>> for FixedU128<FracDst>where
FracSrc: IsLessOrEqual<FracDst, Output = True> + LeEqU32,
U32: Sub<FracSrc>,
U128: Sub<FracDst>,
Diff<U32, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracSrc, FracDst: LeEqU128> From<FixedU32<FracSrc>> for FixedU128<FracDst>where FracSrc: IsLessOrEqual<FracDst, Output = True> + LeEqU32, U32: Sub<FracSrc>, U128: Sub<FracDst>, Diff<U32, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§impl<FracSrc, FracDst: LeEqU128> From<FixedU64<FracSrc>> for FixedU128<FracDst>where
FracSrc: IsLessOrEqual<FracDst, Output = True> + LeEqU64,
U64: Sub<FracSrc>,
U128: Sub<FracDst>,
Diff<U64, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracSrc, FracDst: LeEqU128> From<FixedU64<FracSrc>> for FixedU128<FracDst>where FracSrc: IsLessOrEqual<FracDst, Output = True> + LeEqU64, U64: Sub<FracSrc>, U128: Sub<FracDst>, Diff<U64, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§impl<FracSrc, FracDst: LeEqU128> From<FixedU8<FracSrc>> for FixedU128<FracDst>where
FracSrc: IsLessOrEqual<FracDst, Output = True> + LeEqU8,
U8: Sub<FracSrc>,
U128: Sub<FracDst>,
Diff<U8, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracSrc, FracDst: LeEqU128> From<FixedU8<FracSrc>> for FixedU128<FracDst>where FracSrc: IsLessOrEqual<FracDst, Output = True> + LeEqU8, U8: Sub<FracSrc>, U128: Sub<FracDst>, Diff<U8, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§impl<FracDst: LeEqU128> From<bool> for FixedU128<FracDst>where
U128: Sub<FracDst>,
U1: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracDst: LeEqU128> From<bool> for FixedU128<FracDst>where U128: Sub<FracDst>, U1: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§impl<FracDst: LeEqU128> From<u16> for FixedU128<FracDst>where
U128: Sub<FracDst>,
U16: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracDst: LeEqU128> From<u16> for FixedU128<FracDst>where U128: Sub<FracDst>, U16: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§impl<FracDst: LeEqU128> From<u32> for FixedU128<FracDst>where
U128: Sub<FracDst>,
U32: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracDst: LeEqU128> From<u32> for FixedU128<FracDst>where U128: Sub<FracDst>, U32: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§impl<FracDst: LeEqU128> From<u64> for FixedU128<FracDst>where
U128: Sub<FracDst>,
U64: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracDst: LeEqU128> From<u64> for FixedU128<FracDst>where U128: Sub<FracDst>, U64: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§impl<FracDst: LeEqU128> From<u8> for FixedU128<FracDst>where
U128: Sub<FracDst>,
U8: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracDst: LeEqU128> From<u8> for FixedU128<FracDst>where U128: Sub<FracDst>, U8: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§impl<Frac: LeEqU128> FromFixed for FixedU128<Frac>
impl<Frac: LeEqU128> FromFixed for FixedU128<Frac>
source§fn from_fixed<F: Fixed>(src: F) -> Self
fn from_fixed<F: Fixed>(src: F) -> Self
Converts a fixed-point number.
Any extra fractional bits are truncated.
source§fn checked_from_fixed<F: Fixed>(src: F) -> Option<Self>
fn checked_from_fixed<F: Fixed>(src: F) -> Option<Self>
Converts a fixed-point number if it fits, otherwise returns None
.
Any extra fractional bits are truncated.
source§fn saturating_from_fixed<F: Fixed>(src: F) -> Self
fn saturating_from_fixed<F: Fixed>(src: F) -> Self
Converts a fixed-point number, saturating if it does not fit.
Any extra fractional bits are truncated.
source§fn wrapping_from_fixed<F: Fixed>(src: F) -> Self
fn wrapping_from_fixed<F: Fixed>(src: F) -> Self
Converts a fixed-point number, wrapping if it does not fit.
Any extra fractional bits are truncated.
source§impl<Frac: LeEqU128> LossyFrom<FixedU128<Frac>> for bf16
impl<Frac: LeEqU128> LossyFrom<FixedU128<Frac>> for bf16
source§fn lossy_from(src: FixedU128<Frac>) -> bf16
fn lossy_from(src: FixedU128<Frac>) -> bf16
Converts a fixed-point number to a floating-point number.
This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.
source§impl<Frac: LeEqU128> LossyFrom<FixedU128<Frac>> for f16
impl<Frac: LeEqU128> LossyFrom<FixedU128<Frac>> for f16
source§fn lossy_from(src: FixedU128<Frac>) -> f16
fn lossy_from(src: FixedU128<Frac>) -> f16
Converts a fixed-point number to a floating-point number.
This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.
source§impl<Frac: LeEqU128> LossyFrom<FixedU128<Frac>> for f32
impl<Frac: LeEqU128> LossyFrom<FixedU128<Frac>> for f32
source§fn lossy_from(src: FixedU128<Frac>) -> f32
fn lossy_from(src: FixedU128<Frac>) -> f32
Converts a fixed-point number to a floating-point number.
This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.
source§impl<Frac: LeEqU128> LossyFrom<FixedU128<Frac>> for f64
impl<Frac: LeEqU128> LossyFrom<FixedU128<Frac>> for f64
source§fn lossy_from(src: FixedU128<Frac>) -> f64
fn lossy_from(src: FixedU128<Frac>) -> f64
Converts a fixed-point number to a floating-point number.
This conversion never fails (infallible) but may lose precision (lossy). Rounding is to the nearest, with ties rounded to even.
source§impl<FracSrc: LeEqU128, FracDst: LeEqU128> LossyFrom<FixedU128<FracSrc>> for FixedI128<FracDst>where
U128: Sub<FracSrc>,
U127: Sub<FracDst>,
Diff<U128, FracSrc>: IsLessOrEqual<Diff<U127, FracDst>, Output = True>,
impl<FracSrc: LeEqU128, FracDst: LeEqU128> LossyFrom<FixedU128<FracSrc>> for FixedI128<FracDst>where U128: Sub<FracSrc>, U127: Sub<FracDst>, Diff<U128, FracSrc>: IsLessOrEqual<Diff<U127, FracDst>, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-pint number.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source that cannot be represented in the destination are truncated.
source§impl<FracSrc: LeEqU128, FracDst: LeEqU16> LossyFrom<FixedU128<FracSrc>> for FixedI16<FracDst>where
U128: Sub<FracSrc>,
U15: Sub<FracDst>,
Diff<U128, FracSrc>: IsLessOrEqual<Diff<U15, FracDst>, Output = True>,
impl<FracSrc: LeEqU128, FracDst: LeEqU16> LossyFrom<FixedU128<FracSrc>> for FixedI16<FracDst>where U128: Sub<FracSrc>, U15: Sub<FracDst>, Diff<U128, FracSrc>: IsLessOrEqual<Diff<U15, FracDst>, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-pint number.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source that cannot be represented in the destination are truncated.
source§impl<FracSrc: LeEqU128, FracDst: LeEqU32> LossyFrom<FixedU128<FracSrc>> for FixedI32<FracDst>where
U128: Sub<FracSrc>,
U31: Sub<FracDst>,
Diff<U128, FracSrc>: IsLessOrEqual<Diff<U31, FracDst>, Output = True>,
impl<FracSrc: LeEqU128, FracDst: LeEqU32> LossyFrom<FixedU128<FracSrc>> for FixedI32<FracDst>where U128: Sub<FracSrc>, U31: Sub<FracDst>, Diff<U128, FracSrc>: IsLessOrEqual<Diff<U31, FracDst>, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-pint number.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source that cannot be represented in the destination are truncated.
source§impl<FracSrc: LeEqU128, FracDst: LeEqU64> LossyFrom<FixedU128<FracSrc>> for FixedI64<FracDst>where
U128: Sub<FracSrc>,
U63: Sub<FracDst>,
Diff<U128, FracSrc>: IsLessOrEqual<Diff<U63, FracDst>, Output = True>,
impl<FracSrc: LeEqU128, FracDst: LeEqU64> LossyFrom<FixedU128<FracSrc>> for FixedI64<FracDst>where U128: Sub<FracSrc>, U63: Sub<FracDst>, Diff<U128, FracSrc>: IsLessOrEqual<Diff<U63, FracDst>, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-pint number.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source that cannot be represented in the destination are truncated.
source§impl<FracSrc: LeEqU128, FracDst: LeEqU8> LossyFrom<FixedU128<FracSrc>> for FixedI8<FracDst>where
U128: Sub<FracSrc>,
U7: Sub<FracDst>,
Diff<U128, FracSrc>: IsLessOrEqual<Diff<U7, FracDst>, Output = True>,
impl<FracSrc: LeEqU128, FracDst: LeEqU8> LossyFrom<FixedU128<FracSrc>> for FixedI8<FracDst>where U128: Sub<FracSrc>, U7: Sub<FracDst>, Diff<U128, FracSrc>: IsLessOrEqual<Diff<U7, FracDst>, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-pint number.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source that cannot be represented in the destination are truncated.
source§impl<FracSrc: LeEqU128, FracDst: LeEqU128> LossyFrom<FixedU128<FracSrc>> for FixedU128<FracDst>where
U128: Sub<FracSrc>,
U128: Sub<FracDst>,
Diff<U128, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracSrc: LeEqU128, FracDst: LeEqU128> LossyFrom<FixedU128<FracSrc>> for FixedU128<FracDst>where U128: Sub<FracSrc>, U128: Sub<FracDst>, Diff<U128, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-pint number.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source that cannot be represented in the destination are truncated.
source§impl<FracSrc: LeEqU128, FracDst: LeEqU16> LossyFrom<FixedU128<FracSrc>> for FixedU16<FracDst>where
U128: Sub<FracSrc>,
U16: Sub<FracDst>,
Diff<U128, FracSrc>: IsLessOrEqual<Diff<U16, FracDst>, Output = True>,
impl<FracSrc: LeEqU128, FracDst: LeEqU16> LossyFrom<FixedU128<FracSrc>> for FixedU16<FracDst>where U128: Sub<FracSrc>, U16: Sub<FracDst>, Diff<U128, FracSrc>: IsLessOrEqual<Diff<U16, FracDst>, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-pint number.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source that cannot be represented in the destination are truncated.
source§impl<FracSrc: LeEqU128, FracDst: LeEqU32> LossyFrom<FixedU128<FracSrc>> for FixedU32<FracDst>where
U128: Sub<FracSrc>,
U32: Sub<FracDst>,
Diff<U128, FracSrc>: IsLessOrEqual<Diff<U32, FracDst>, Output = True>,
impl<FracSrc: LeEqU128, FracDst: LeEqU32> LossyFrom<FixedU128<FracSrc>> for FixedU32<FracDst>where U128: Sub<FracSrc>, U32: Sub<FracDst>, Diff<U128, FracSrc>: IsLessOrEqual<Diff<U32, FracDst>, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-pint number.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source that cannot be represented in the destination are truncated.
source§impl<FracSrc: LeEqU128, FracDst: LeEqU64> LossyFrom<FixedU128<FracSrc>> for FixedU64<FracDst>where
U128: Sub<FracSrc>,
U64: Sub<FracDst>,
Diff<U128, FracSrc>: IsLessOrEqual<Diff<U64, FracDst>, Output = True>,
impl<FracSrc: LeEqU128, FracDst: LeEqU64> LossyFrom<FixedU128<FracSrc>> for FixedU64<FracDst>where U128: Sub<FracSrc>, U64: Sub<FracDst>, Diff<U128, FracSrc>: IsLessOrEqual<Diff<U64, FracDst>, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-pint number.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source that cannot be represented in the destination are truncated.
source§impl<FracSrc: LeEqU128, FracDst: LeEqU8> LossyFrom<FixedU128<FracSrc>> for FixedU8<FracDst>where
U128: Sub<FracSrc>,
U8: Sub<FracDst>,
Diff<U128, FracSrc>: IsLessOrEqual<Diff<U8, FracDst>, Output = True>,
impl<FracSrc: LeEqU128, FracDst: LeEqU8> LossyFrom<FixedU128<FracSrc>> for FixedU8<FracDst>where U128: Sub<FracSrc>, U8: Sub<FracDst>, Diff<U128, FracSrc>: IsLessOrEqual<Diff<U8, FracDst>, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-pint number.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source that cannot be represented in the destination are truncated.
source§impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for i128where
U128: Sub<FracSrc>,
Diff<U128, FracSrc>: IsLessOrEqual<U127, Output = True>,
impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for i128where U128: Sub<FracSrc>, Diff<U128, FracSrc>: IsLessOrEqual<U127, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source are truncated.
source§impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for i16where
U128: Sub<FracSrc>,
Diff<U128, FracSrc>: IsLessOrEqual<U15, Output = True>,
impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for i16where U128: Sub<FracSrc>, Diff<U128, FracSrc>: IsLessOrEqual<U15, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source are truncated.
source§impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for i32where
U128: Sub<FracSrc>,
Diff<U128, FracSrc>: IsLessOrEqual<U31, Output = True>,
impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for i32where U128: Sub<FracSrc>, Diff<U128, FracSrc>: IsLessOrEqual<U31, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source are truncated.
source§impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for i64where
U128: Sub<FracSrc>,
Diff<U128, FracSrc>: IsLessOrEqual<U63, Output = True>,
impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for i64where U128: Sub<FracSrc>, Diff<U128, FracSrc>: IsLessOrEqual<U63, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source are truncated.
source§impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for i8where
U128: Sub<FracSrc>,
Diff<U128, FracSrc>: IsLessOrEqual<U7, Output = True>,
impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for i8where U128: Sub<FracSrc>, Diff<U128, FracSrc>: IsLessOrEqual<U7, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source are truncated.
source§impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for isizewhere
U128: Sub<FracSrc>,
Diff<U128, FracSrc>: IsLessOrEqual<U15, Output = True>,
impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for isizewhere U128: Sub<FracSrc>, Diff<U128, FracSrc>: IsLessOrEqual<U15, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source are truncated.
source§impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for u128where
U128: Sub<FracSrc>,
Diff<U128, FracSrc>: IsLessOrEqual<U128, Output = True>,
impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for u128where U128: Sub<FracSrc>, Diff<U128, FracSrc>: IsLessOrEqual<U128, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source are truncated.
source§impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for u16where
U128: Sub<FracSrc>,
Diff<U128, FracSrc>: IsLessOrEqual<U16, Output = True>,
impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for u16where U128: Sub<FracSrc>, Diff<U128, FracSrc>: IsLessOrEqual<U16, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source are truncated.
source§impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for u32where
U128: Sub<FracSrc>,
Diff<U128, FracSrc>: IsLessOrEqual<U32, Output = True>,
impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for u32where U128: Sub<FracSrc>, Diff<U128, FracSrc>: IsLessOrEqual<U32, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source are truncated.
source§impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for u64where
U128: Sub<FracSrc>,
Diff<U128, FracSrc>: IsLessOrEqual<U64, Output = True>,
impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for u64where U128: Sub<FracSrc>, Diff<U128, FracSrc>: IsLessOrEqual<U64, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source are truncated.
source§impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for u8where
U128: Sub<FracSrc>,
Diff<U128, FracSrc>: IsLessOrEqual<U8, Output = True>,
impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for u8where U128: Sub<FracSrc>, Diff<U128, FracSrc>: IsLessOrEqual<U8, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source are truncated.
source§impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for usizewhere
U128: Sub<FracSrc>,
Diff<U128, FracSrc>: IsLessOrEqual<U16, Output = True>,
impl<FracSrc: LeEqU128> LossyFrom<FixedU128<FracSrc>> for usizewhere U128: Sub<FracSrc>, Diff<U128, FracSrc>: IsLessOrEqual<U16, Output = True>,
source§fn lossy_from(src: FixedU128<FracSrc>) -> Self
fn lossy_from(src: FixedU128<FracSrc>) -> Self
Converts a fixed-point number to an integer.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source are truncated.
source§impl<FracSrc: LeEqU16, FracDst: LeEqU128> LossyFrom<FixedU16<FracSrc>> for FixedU128<FracDst>where
U16: Sub<FracSrc>,
U128: Sub<FracDst>,
Diff<U16, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracSrc: LeEqU16, FracDst: LeEqU128> LossyFrom<FixedU16<FracSrc>> for FixedU128<FracDst>where U16: Sub<FracSrc>, U128: Sub<FracDst>, Diff<U16, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§fn lossy_from(src: FixedU16<FracSrc>) -> Self
fn lossy_from(src: FixedU16<FracSrc>) -> Self
Converts a fixed-pint number.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source that cannot be represented in the destination are truncated.
source§impl<FracSrc: LeEqU32, FracDst: LeEqU128> LossyFrom<FixedU32<FracSrc>> for FixedU128<FracDst>where
U32: Sub<FracSrc>,
U128: Sub<FracDst>,
Diff<U32, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracSrc: LeEqU32, FracDst: LeEqU128> LossyFrom<FixedU32<FracSrc>> for FixedU128<FracDst>where U32: Sub<FracSrc>, U128: Sub<FracDst>, Diff<U32, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§fn lossy_from(src: FixedU32<FracSrc>) -> Self
fn lossy_from(src: FixedU32<FracSrc>) -> Self
Converts a fixed-pint number.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source that cannot be represented in the destination are truncated.
source§impl<FracSrc: LeEqU64, FracDst: LeEqU128> LossyFrom<FixedU64<FracSrc>> for FixedU128<FracDst>where
U64: Sub<FracSrc>,
U128: Sub<FracDst>,
Diff<U64, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracSrc: LeEqU64, FracDst: LeEqU128> LossyFrom<FixedU64<FracSrc>> for FixedU128<FracDst>where U64: Sub<FracSrc>, U128: Sub<FracDst>, Diff<U64, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§fn lossy_from(src: FixedU64<FracSrc>) -> Self
fn lossy_from(src: FixedU64<FracSrc>) -> Self
Converts a fixed-pint number.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source that cannot be represented in the destination are truncated.
source§impl<FracSrc: LeEqU8, FracDst: LeEqU128> LossyFrom<FixedU8<FracSrc>> for FixedU128<FracDst>where
U8: Sub<FracSrc>,
U128: Sub<FracDst>,
Diff<U8, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracSrc: LeEqU8, FracDst: LeEqU128> LossyFrom<FixedU8<FracSrc>> for FixedU128<FracDst>where U8: Sub<FracSrc>, U128: Sub<FracDst>, Diff<U8, FracSrc>: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§fn lossy_from(src: FixedU8<FracSrc>) -> Self
fn lossy_from(src: FixedU8<FracSrc>) -> Self
Converts a fixed-pint number.
This conversion never fails (infallible) but may lose precision (lossy). Any fractional bits in the source that cannot be represented in the destination are truncated.
source§impl<FracDst: LeEqU128> LossyFrom<bool> for FixedU128<FracDst>where
U128: Sub<FracDst>,
U1: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracDst: LeEqU128> LossyFrom<bool> for FixedU128<FracDst>where U128: Sub<FracDst>, U1: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§fn lossy_from(src: bool) -> Self
fn lossy_from(src: bool) -> Self
Converts a bool
to a fixed-point number.
This conversion never fails (infallible) and cannot lose any fractional bits, so it is actually lossless.
source§impl LossyFrom<u128> for FixedU128<U0>
impl LossyFrom<u128> for FixedU128<U0>
source§fn lossy_from(src: u128) -> Self
fn lossy_from(src: u128) -> Self
Converts a number.
This conversion never fails (infallible) and does not lose any precision, so it is actually lossless.
source§impl<FracDst: LeEqU128> LossyFrom<u16> for FixedU128<FracDst>where
U128: Sub<FracDst>,
U16: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracDst: LeEqU128> LossyFrom<u16> for FixedU128<FracDst>where U128: Sub<FracDst>, U16: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§fn lossy_from(src: u16) -> Self
fn lossy_from(src: u16) -> Self
Converts an integer to a fixed-point number.
This conversion never fails (infallible) and cannot lose any fractional bits, so it is actually lossless.
source§impl<FracDst: LeEqU128> LossyFrom<u32> for FixedU128<FracDst>where
U128: Sub<FracDst>,
U32: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracDst: LeEqU128> LossyFrom<u32> for FixedU128<FracDst>where U128: Sub<FracDst>, U32: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§fn lossy_from(src: u32) -> Self
fn lossy_from(src: u32) -> Self
Converts an integer to a fixed-point number.
This conversion never fails (infallible) and cannot lose any fractional bits, so it is actually lossless.
source§impl<FracDst: LeEqU128> LossyFrom<u64> for FixedU128<FracDst>where
U128: Sub<FracDst>,
U64: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracDst: LeEqU128> LossyFrom<u64> for FixedU128<FracDst>where U128: Sub<FracDst>, U64: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§fn lossy_from(src: u64) -> Self
fn lossy_from(src: u64) -> Self
Converts an integer to a fixed-point number.
This conversion never fails (infallible) and cannot lose any fractional bits, so it is actually lossless.
source§impl<FracDst: LeEqU128> LossyFrom<u8> for FixedU128<FracDst>where
U128: Sub<FracDst>,
U8: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
impl<FracDst: LeEqU128> LossyFrom<u8> for FixedU128<FracDst>where U128: Sub<FracDst>, U8: IsLessOrEqual<Diff<U128, FracDst>, Output = True>,
source§fn lossy_from(src: u8) -> Self
fn lossy_from(src: u8) -> Self
Converts an integer to a fixed-point number.
This conversion never fails (infallible) and cannot lose any fractional bits, so it is actually lossless.
source§impl<Frac> MaxEncodedLen for FixedU128<Frac>where
PhantomData<Frac>: MaxEncodedLen,
impl<Frac> MaxEncodedLen for FixedU128<Frac>where PhantomData<Frac>: MaxEncodedLen,
source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
source§impl<'a, Frac: LeEqU128> MulAssign<&'a FixedU128<Frac>> for FixedU128<Frac>
impl<'a, Frac: LeEqU128> MulAssign<&'a FixedU128<Frac>> for FixedU128<Frac>
source§fn mul_assign(&mut self, rhs: &FixedU128<Frac>)
fn mul_assign(&mut self, rhs: &FixedU128<Frac>)
*=
operation. Read moresource§impl<'a, Frac: LeEqU128> MulAssign<&'a u128> for FixedU128<Frac>
impl<'a, Frac: LeEqU128> MulAssign<&'a u128> for FixedU128<Frac>
source§fn mul_assign(&mut self, rhs: &u128)
fn mul_assign(&mut self, rhs: &u128)
*=
operation. Read moresource§impl<Frac: LeEqU128> MulAssign<u128> for FixedU128<Frac>
impl<Frac: LeEqU128> MulAssign<u128> for FixedU128<Frac>
source§fn mul_assign(&mut self, rhs: u128)
fn mul_assign(&mut self, rhs: u128)
*=
operation. Read moresource§impl<Frac: LeEqU128> MulAssign for FixedU128<Frac>
impl<Frac: LeEqU128> MulAssign for FixedU128<Frac>
source§fn mul_assign(&mut self, rhs: FixedU128<Frac>)
fn mul_assign(&mut self, rhs: FixedU128<Frac>)
*=
operation. Read moresource§impl<Frac: LeEqU128> Ord for FixedU128<Frac>
impl<Frac: LeEqU128> Ord for FixedU128<Frac>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl<FracSrc: LeEqU128, FracDst: LeEqU128> OverflowingCast<FixedI128<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU128> OverflowingCast<FixedI128<FracDst>> for FixedU128<FracSrc>
source§fn overflowing_cast(self) -> (FixedI128<FracDst>, bool)
fn overflowing_cast(self) -> (FixedI128<FracDst>, bool)
source§impl<FracSrc: LeEqU128, FracDst: LeEqU16> OverflowingCast<FixedI16<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU16> OverflowingCast<FixedI16<FracDst>> for FixedU128<FracSrc>
source§fn overflowing_cast(self) -> (FixedI16<FracDst>, bool)
fn overflowing_cast(self) -> (FixedI16<FracDst>, bool)
source§impl<FracSrc: LeEqU128, FracDst: LeEqU32> OverflowingCast<FixedI32<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU32> OverflowingCast<FixedI32<FracDst>> for FixedU128<FracSrc>
source§fn overflowing_cast(self) -> (FixedI32<FracDst>, bool)
fn overflowing_cast(self) -> (FixedI32<FracDst>, bool)
source§impl<FracSrc: LeEqU128, FracDst: LeEqU64> OverflowingCast<FixedI64<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU64> OverflowingCast<FixedI64<FracDst>> for FixedU128<FracSrc>
source§fn overflowing_cast(self) -> (FixedI64<FracDst>, bool)
fn overflowing_cast(self) -> (FixedI64<FracDst>, bool)
source§impl<FracSrc: LeEqU128, FracDst: LeEqU8> OverflowingCast<FixedI8<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU8> OverflowingCast<FixedI8<FracDst>> for FixedU128<FracSrc>
source§fn overflowing_cast(self) -> (FixedI8<FracDst>, bool)
fn overflowing_cast(self) -> (FixedI8<FracDst>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for bf16
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for bf16
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for bool
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for bool
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for f16
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for f16
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for f32
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for f32
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for f64
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for f64
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for i128
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for i128
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for i16
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for i16
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for i32
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for i32
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for i64
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for i64
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for i8
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for i8
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for isize
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for isize
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for u128
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for u128
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for u16
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for u16
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for u32
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for u32
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for u64
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for u64
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for u8
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for u8
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for usize
impl<Frac: LeEqU128> OverflowingCast<FixedU128<Frac>> for usize
source§fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
fn overflowing_cast(self) -> (FixedU128<Frac>, bool)
source§impl<FracSrc: LeEqU128, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedI128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedI128<FracSrc>
source§fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
source§impl<FracSrc: LeEqU16, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedI16<FracSrc>
impl<FracSrc: LeEqU16, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedI16<FracSrc>
source§fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
source§impl<FracSrc: LeEqU32, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedI32<FracSrc>
impl<FracSrc: LeEqU32, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedI32<FracSrc>
source§fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
source§impl<FracSrc: LeEqU64, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedI64<FracSrc>
impl<FracSrc: LeEqU64, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedI64<FracSrc>
source§fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
source§impl<FracSrc: LeEqU8, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedI8<FracSrc>
impl<FracSrc: LeEqU8, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedI8<FracSrc>
source§fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
source§impl<FracSrc: LeEqU128, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedU128<FracSrc>
source§fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
source§impl<FracSrc: LeEqU16, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedU16<FracSrc>
impl<FracSrc: LeEqU16, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedU16<FracSrc>
source§fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
source§impl<FracSrc: LeEqU32, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedU32<FracSrc>
impl<FracSrc: LeEqU32, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedU32<FracSrc>
source§fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
source§impl<FracSrc: LeEqU64, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedU64<FracSrc>
impl<FracSrc: LeEqU64, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedU64<FracSrc>
source§fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
source§impl<FracSrc: LeEqU8, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedU8<FracSrc>
impl<FracSrc: LeEqU8, FracDst: LeEqU128> OverflowingCast<FixedU128<FracDst>> for FixedU8<FracSrc>
source§fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
fn overflowing_cast(self) -> (FixedU128<FracDst>, bool)
source§impl<FracSrc: LeEqU128, FracDst: LeEqU16> OverflowingCast<FixedU16<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU16> OverflowingCast<FixedU16<FracDst>> for FixedU128<FracSrc>
source§fn overflowing_cast(self) -> (FixedU16<FracDst>, bool)
fn overflowing_cast(self) -> (FixedU16<FracDst>, bool)
source§impl<FracSrc: LeEqU128, FracDst: LeEqU32> OverflowingCast<FixedU32<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU32> OverflowingCast<FixedU32<FracDst>> for FixedU128<FracSrc>
source§fn overflowing_cast(self) -> (FixedU32<FracDst>, bool)
fn overflowing_cast(self) -> (FixedU32<FracDst>, bool)
source§impl<FracSrc: LeEqU128, FracDst: LeEqU64> OverflowingCast<FixedU64<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU64> OverflowingCast<FixedU64<FracDst>> for FixedU128<FracSrc>
source§fn overflowing_cast(self) -> (FixedU64<FracDst>, bool)
fn overflowing_cast(self) -> (FixedU64<FracDst>, bool)
source§impl<FracSrc: LeEqU128, FracDst: LeEqU8> OverflowingCast<FixedU8<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU8> OverflowingCast<FixedU8<FracDst>> for FixedU128<FracSrc>
source§fn overflowing_cast(self) -> (FixedU8<FracDst>, bool)
fn overflowing_cast(self) -> (FixedU8<FracDst>, bool)
source§impl<Frac: LeEqU128> OverflowingCast<bf16> for FixedU128<Frac>
impl<Frac: LeEqU128> OverflowingCast<bf16> for FixedU128<Frac>
source§fn overflowing_cast(self) -> (bf16, bool)
fn overflowing_cast(self) -> (bf16, bool)
source§impl<Frac: LeEqU128> OverflowingCast<f16> for FixedU128<Frac>
impl<Frac: LeEqU128> OverflowingCast<f16> for FixedU128<Frac>
source§fn overflowing_cast(self) -> (f16, bool)
fn overflowing_cast(self) -> (f16, bool)
source§impl<Frac: LeEqU128> OverflowingCast<f32> for FixedU128<Frac>
impl<Frac: LeEqU128> OverflowingCast<f32> for FixedU128<Frac>
source§fn overflowing_cast(self) -> (f32, bool)
fn overflowing_cast(self) -> (f32, bool)
source§impl<Frac: LeEqU128> OverflowingCast<f64> for FixedU128<Frac>
impl<Frac: LeEqU128> OverflowingCast<f64> for FixedU128<Frac>
source§fn overflowing_cast(self) -> (f64, bool)
fn overflowing_cast(self) -> (f64, bool)
source§impl<Frac: LeEqU128> OverflowingCast<i128> for FixedU128<Frac>
impl<Frac: LeEqU128> OverflowingCast<i128> for FixedU128<Frac>
source§fn overflowing_cast(self) -> (i128, bool)
fn overflowing_cast(self) -> (i128, bool)
source§impl<Frac: LeEqU128> OverflowingCast<i16> for FixedU128<Frac>
impl<Frac: LeEqU128> OverflowingCast<i16> for FixedU128<Frac>
source§fn overflowing_cast(self) -> (i16, bool)
fn overflowing_cast(self) -> (i16, bool)
source§impl<Frac: LeEqU128> OverflowingCast<i32> for FixedU128<Frac>
impl<Frac: LeEqU128> OverflowingCast<i32> for FixedU128<Frac>
source§fn overflowing_cast(self) -> (i32, bool)
fn overflowing_cast(self) -> (i32, bool)
source§impl<Frac: LeEqU128> OverflowingCast<i64> for FixedU128<Frac>
impl<Frac: LeEqU128> OverflowingCast<i64> for FixedU128<Frac>
source§fn overflowing_cast(self) -> (i64, bool)
fn overflowing_cast(self) -> (i64, bool)
source§impl<Frac: LeEqU128> OverflowingCast<i8> for FixedU128<Frac>
impl<Frac: LeEqU128> OverflowingCast<i8> for FixedU128<Frac>
source§fn overflowing_cast(self) -> (i8, bool)
fn overflowing_cast(self) -> (i8, bool)
source§impl<Frac: LeEqU128> OverflowingCast<isize> for FixedU128<Frac>
impl<Frac: LeEqU128> OverflowingCast<isize> for FixedU128<Frac>
source§fn overflowing_cast(self) -> (isize, bool)
fn overflowing_cast(self) -> (isize, bool)
source§impl<Frac: LeEqU128> OverflowingCast<u128> for FixedU128<Frac>
impl<Frac: LeEqU128> OverflowingCast<u128> for FixedU128<Frac>
source§fn overflowing_cast(self) -> (u128, bool)
fn overflowing_cast(self) -> (u128, bool)
source§impl<Frac: LeEqU128> OverflowingCast<u16> for FixedU128<Frac>
impl<Frac: LeEqU128> OverflowingCast<u16> for FixedU128<Frac>
source§fn overflowing_cast(self) -> (u16, bool)
fn overflowing_cast(self) -> (u16, bool)
source§impl<Frac: LeEqU128> OverflowingCast<u32> for FixedU128<Frac>
impl<Frac: LeEqU128> OverflowingCast<u32> for FixedU128<Frac>
source§fn overflowing_cast(self) -> (u32, bool)
fn overflowing_cast(self) -> (u32, bool)
source§impl<Frac: LeEqU128> OverflowingCast<u64> for FixedU128<Frac>
impl<Frac: LeEqU128> OverflowingCast<u64> for FixedU128<Frac>
source§fn overflowing_cast(self) -> (u64, bool)
fn overflowing_cast(self) -> (u64, bool)
source§impl<Frac: LeEqU128> OverflowingCast<u8> for FixedU128<Frac>
impl<Frac: LeEqU128> OverflowingCast<u8> for FixedU128<Frac>
source§fn overflowing_cast(self) -> (u8, bool)
fn overflowing_cast(self) -> (u8, bool)
source§impl<Frac: LeEqU128> OverflowingCast<usize> for FixedU128<Frac>
impl<Frac: LeEqU128> OverflowingCast<usize> for FixedU128<Frac>
source§fn overflowing_cast(self) -> (usize, bool)
fn overflowing_cast(self) -> (usize, bool)
source§impl<FracLhs: LeEqU128, FracRhs: LeEqU128> PartialEq<FixedI128<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU128> PartialEq<FixedI128<FracRhs>> for FixedU128<FracLhs>
source§impl<FracLhs: LeEqU128, FracRhs: LeEqU16> PartialEq<FixedI16<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU16> PartialEq<FixedI16<FracRhs>> for FixedU128<FracLhs>
source§impl<FracLhs: LeEqU128, FracRhs: LeEqU32> PartialEq<FixedI32<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU32> PartialEq<FixedI32<FracRhs>> for FixedU128<FracLhs>
source§impl<FracLhs: LeEqU128, FracRhs: LeEqU64> PartialEq<FixedI64<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU64> PartialEq<FixedI64<FracRhs>> for FixedU128<FracLhs>
source§impl<FracLhs: LeEqU128, FracRhs: LeEqU8> PartialEq<FixedI8<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU8> PartialEq<FixedI8<FracRhs>> for FixedU128<FracLhs>
source§impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for bf16
impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for bf16
source§impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for f16
impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for f16
source§impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for f32
impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for f32
source§impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for f64
impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for f64
source§impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for i128
impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for i128
source§impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for i16
impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for i16
source§impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for i32
impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for i32
source§impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for i64
impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for i64
source§impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for i8
impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for i8
source§impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for isize
impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for isize
source§impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for u128
impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for u128
source§impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for u16
impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for u16
source§impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for u32
impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for u32
source§impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for u64
impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for u64
source§impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for u8
impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for u8
source§impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for usize
impl<Frac: LeEqU128> PartialEq<FixedU128<Frac>> for usize
source§impl<FracLhs: LeEqU128, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedI128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedI128<FracLhs>
source§impl<FracLhs: LeEqU16, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedI16<FracLhs>
impl<FracLhs: LeEqU16, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedI16<FracLhs>
source§impl<FracLhs: LeEqU32, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedI32<FracLhs>
impl<FracLhs: LeEqU32, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedI32<FracLhs>
source§impl<FracLhs: LeEqU64, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedI64<FracLhs>
impl<FracLhs: LeEqU64, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedI64<FracLhs>
source§impl<FracLhs: LeEqU8, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedI8<FracLhs>
impl<FracLhs: LeEqU8, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedI8<FracLhs>
source§impl<FracLhs: LeEqU128, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedU128<FracLhs>
source§impl<FracLhs: LeEqU16, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedU16<FracLhs>
impl<FracLhs: LeEqU16, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedU16<FracLhs>
source§impl<FracLhs: LeEqU32, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedU32<FracLhs>
impl<FracLhs: LeEqU32, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedU32<FracLhs>
source§impl<FracLhs: LeEqU64, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedU64<FracLhs>
impl<FracLhs: LeEqU64, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedU64<FracLhs>
source§impl<FracLhs: LeEqU8, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedU8<FracLhs>
impl<FracLhs: LeEqU8, FracRhs: LeEqU128> PartialEq<FixedU128<FracRhs>> for FixedU8<FracLhs>
source§impl<FracLhs: LeEqU128, FracRhs: LeEqU16> PartialEq<FixedU16<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU16> PartialEq<FixedU16<FracRhs>> for FixedU128<FracLhs>
source§impl<FracLhs: LeEqU128, FracRhs: LeEqU32> PartialEq<FixedU32<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU32> PartialEq<FixedU32<FracRhs>> for FixedU128<FracLhs>
source§impl<FracLhs: LeEqU128, FracRhs: LeEqU64> PartialEq<FixedU64<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU64> PartialEq<FixedU64<FracRhs>> for FixedU128<FracLhs>
source§impl<FracLhs: LeEqU128, FracRhs: LeEqU8> PartialEq<FixedU8<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU8> PartialEq<FixedU8<FracRhs>> for FixedU128<FracLhs>
source§impl<FracLhs: LeEqU128, FracRhs: LeEqU128> PartialOrd<FixedI128<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU128> PartialOrd<FixedI128<FracRhs>> for FixedU128<FracLhs>
source§fn le(&self, rhs: &FixedI128<FracRhs>) -> bool
fn le(&self, rhs: &FixedI128<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU128, FracRhs: LeEqU16> PartialOrd<FixedI16<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU16> PartialOrd<FixedI16<FracRhs>> for FixedU128<FracLhs>
source§fn le(&self, rhs: &FixedI16<FracRhs>) -> bool
fn le(&self, rhs: &FixedI16<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU128, FracRhs: LeEqU32> PartialOrd<FixedI32<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU32> PartialOrd<FixedI32<FracRhs>> for FixedU128<FracLhs>
source§fn le(&self, rhs: &FixedI32<FracRhs>) -> bool
fn le(&self, rhs: &FixedI32<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU128, FracRhs: LeEqU64> PartialOrd<FixedI64<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU64> PartialOrd<FixedI64<FracRhs>> for FixedU128<FracLhs>
source§fn le(&self, rhs: &FixedI64<FracRhs>) -> bool
fn le(&self, rhs: &FixedI64<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU128, FracRhs: LeEqU8> PartialOrd<FixedI8<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU8> PartialOrd<FixedI8<FracRhs>> for FixedU128<FracLhs>
source§fn le(&self, rhs: &FixedI8<FracRhs>) -> bool
fn le(&self, rhs: &FixedI8<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for bf16
impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for bf16
source§fn le(&self, rhs: &FixedU128<Frac>) -> bool
fn le(&self, rhs: &FixedU128<Frac>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for f16
impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for f16
source§fn le(&self, rhs: &FixedU128<Frac>) -> bool
fn le(&self, rhs: &FixedU128<Frac>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for f32
impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for f32
source§fn le(&self, rhs: &FixedU128<Frac>) -> bool
fn le(&self, rhs: &FixedU128<Frac>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for f64
impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for f64
source§fn le(&self, rhs: &FixedU128<Frac>) -> bool
fn le(&self, rhs: &FixedU128<Frac>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for i128
impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for i128
source§fn le(&self, rhs: &FixedU128<Frac>) -> bool
fn le(&self, rhs: &FixedU128<Frac>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for i16
impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for i16
source§fn le(&self, rhs: &FixedU128<Frac>) -> bool
fn le(&self, rhs: &FixedU128<Frac>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for i32
impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for i32
source§fn le(&self, rhs: &FixedU128<Frac>) -> bool
fn le(&self, rhs: &FixedU128<Frac>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for i64
impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for i64
source§fn le(&self, rhs: &FixedU128<Frac>) -> bool
fn le(&self, rhs: &FixedU128<Frac>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for i8
impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for i8
source§fn le(&self, rhs: &FixedU128<Frac>) -> bool
fn le(&self, rhs: &FixedU128<Frac>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for isize
impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for isize
source§fn le(&self, rhs: &FixedU128<Frac>) -> bool
fn le(&self, rhs: &FixedU128<Frac>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for u128
impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for u128
source§fn le(&self, rhs: &FixedU128<Frac>) -> bool
fn le(&self, rhs: &FixedU128<Frac>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for u16
impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for u16
source§fn le(&self, rhs: &FixedU128<Frac>) -> bool
fn le(&self, rhs: &FixedU128<Frac>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for u32
impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for u32
source§fn le(&self, rhs: &FixedU128<Frac>) -> bool
fn le(&self, rhs: &FixedU128<Frac>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for u64
impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for u64
source§fn le(&self, rhs: &FixedU128<Frac>) -> bool
fn le(&self, rhs: &FixedU128<Frac>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for u8
impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for u8
source§fn le(&self, rhs: &FixedU128<Frac>) -> bool
fn le(&self, rhs: &FixedU128<Frac>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for usize
impl<Frac: LeEqU128> PartialOrd<FixedU128<Frac>> for usize
source§fn le(&self, rhs: &FixedU128<Frac>) -> bool
fn le(&self, rhs: &FixedU128<Frac>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU128, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedI128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedI128<FracLhs>
source§fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU16, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedI16<FracLhs>
impl<FracLhs: LeEqU16, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedI16<FracLhs>
source§fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU32, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedI32<FracLhs>
impl<FracLhs: LeEqU32, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedI32<FracLhs>
source§fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU64, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedI64<FracLhs>
impl<FracLhs: LeEqU64, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedI64<FracLhs>
source§fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU8, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedI8<FracLhs>
impl<FracLhs: LeEqU8, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedI8<FracLhs>
source§fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU128, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedU128<FracLhs>
source§fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU16, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedU16<FracLhs>
impl<FracLhs: LeEqU16, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedU16<FracLhs>
source§fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU32, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedU32<FracLhs>
impl<FracLhs: LeEqU32, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedU32<FracLhs>
source§fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU64, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedU64<FracLhs>
impl<FracLhs: LeEqU64, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedU64<FracLhs>
source§fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU8, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedU8<FracLhs>
impl<FracLhs: LeEqU8, FracRhs: LeEqU128> PartialOrd<FixedU128<FracRhs>> for FixedU8<FracLhs>
source§fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
fn le(&self, rhs: &FixedU128<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU128, FracRhs: LeEqU16> PartialOrd<FixedU16<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU16> PartialOrd<FixedU16<FracRhs>> for FixedU128<FracLhs>
source§fn le(&self, rhs: &FixedU16<FracRhs>) -> bool
fn le(&self, rhs: &FixedU16<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU128, FracRhs: LeEqU32> PartialOrd<FixedU32<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU32> PartialOrd<FixedU32<FracRhs>> for FixedU128<FracLhs>
source§fn le(&self, rhs: &FixedU32<FracRhs>) -> bool
fn le(&self, rhs: &FixedU32<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU128, FracRhs: LeEqU64> PartialOrd<FixedU64<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU64> PartialOrd<FixedU64<FracRhs>> for FixedU128<FracLhs>
source§fn le(&self, rhs: &FixedU64<FracRhs>) -> bool
fn le(&self, rhs: &FixedU64<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<FracLhs: LeEqU128, FracRhs: LeEqU8> PartialOrd<FixedU8<FracRhs>> for FixedU128<FracLhs>
impl<FracLhs: LeEqU128, FracRhs: LeEqU8> PartialOrd<FixedU8<FracRhs>> for FixedU128<FracLhs>
source§fn le(&self, rhs: &FixedU8<FracRhs>) -> bool
fn le(&self, rhs: &FixedU8<FracRhs>) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<Frac: LeEqU128> PartialOrd<bf16> for FixedU128<Frac>
impl<Frac: LeEqU128> PartialOrd<bf16> for FixedU128<Frac>
source§impl<Frac: LeEqU128> PartialOrd<f16> for FixedU128<Frac>
impl<Frac: LeEqU128> PartialOrd<f16> for FixedU128<Frac>
source§impl<Frac: LeEqU128> PartialOrd<f32> for FixedU128<Frac>
impl<Frac: LeEqU128> PartialOrd<f32> for FixedU128<Frac>
source§impl<Frac: LeEqU128> PartialOrd<f64> for FixedU128<Frac>
impl<Frac: LeEqU128> PartialOrd<f64> for FixedU128<Frac>
source§impl<Frac: LeEqU128> PartialOrd<i128> for FixedU128<Frac>
impl<Frac: LeEqU128> PartialOrd<i128> for FixedU128<Frac>
source§impl<Frac: LeEqU128> PartialOrd<i16> for FixedU128<Frac>
impl<Frac: LeEqU128> PartialOrd<i16> for FixedU128<Frac>
source§impl<Frac: LeEqU128> PartialOrd<i32> for FixedU128<Frac>
impl<Frac: LeEqU128> PartialOrd<i32> for FixedU128<Frac>
source§impl<Frac: LeEqU128> PartialOrd<i64> for FixedU128<Frac>
impl<Frac: LeEqU128> PartialOrd<i64> for FixedU128<Frac>
source§impl<Frac: LeEqU128> PartialOrd<i8> for FixedU128<Frac>
impl<Frac: LeEqU128> PartialOrd<i8> for FixedU128<Frac>
source§impl<Frac: LeEqU128> PartialOrd<isize> for FixedU128<Frac>
impl<Frac: LeEqU128> PartialOrd<isize> for FixedU128<Frac>
source§impl<Frac: LeEqU128> PartialOrd<u128> for FixedU128<Frac>
impl<Frac: LeEqU128> PartialOrd<u128> for FixedU128<Frac>
source§impl<Frac: LeEqU128> PartialOrd<u16> for FixedU128<Frac>
impl<Frac: LeEqU128> PartialOrd<u16> for FixedU128<Frac>
source§impl<Frac: LeEqU128> PartialOrd<u32> for FixedU128<Frac>
impl<Frac: LeEqU128> PartialOrd<u32> for FixedU128<Frac>
source§impl<Frac: LeEqU128> PartialOrd<u64> for FixedU128<Frac>
impl<Frac: LeEqU128> PartialOrd<u64> for FixedU128<Frac>
source§impl<Frac: LeEqU128> PartialOrd<u8> for FixedU128<Frac>
impl<Frac: LeEqU128> PartialOrd<u8> for FixedU128<Frac>
source§impl<Frac: LeEqU128> PartialOrd<usize> for FixedU128<Frac>
impl<Frac: LeEqU128> PartialOrd<usize> for FixedU128<Frac>
source§impl<'a, Frac> RemAssign<&'a FixedU128<Frac>> for FixedU128<Frac>
impl<'a, Frac> RemAssign<&'a FixedU128<Frac>> for FixedU128<Frac>
source§fn rem_assign(&mut self, rhs: &FixedU128<Frac>)
fn rem_assign(&mut self, rhs: &FixedU128<Frac>)
%=
operation. Read moresource§impl<'a, Frac: LeEqU128> RemAssign<&'a u128> for FixedU128<Frac>
impl<'a, Frac: LeEqU128> RemAssign<&'a u128> for FixedU128<Frac>
source§fn rem_assign(&mut self, rhs: &u128)
fn rem_assign(&mut self, rhs: &u128)
%=
operation. Read moresource§impl<Frac: LeEqU128> RemAssign<u128> for FixedU128<Frac>
impl<Frac: LeEqU128> RemAssign<u128> for FixedU128<Frac>
source§fn rem_assign(&mut self, rhs: u128)
fn rem_assign(&mut self, rhs: u128)
%=
operation. Read moresource§impl<Frac> RemAssign for FixedU128<Frac>
impl<Frac> RemAssign for FixedU128<Frac>
source§fn rem_assign(&mut self, rhs: FixedU128<Frac>)
fn rem_assign(&mut self, rhs: FixedU128<Frac>)
%=
operation. Read moresource§impl<FracSrc: LeEqU128, FracDst: LeEqU128> SaturatingCast<FixedI128<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU128> SaturatingCast<FixedI128<FracDst>> for FixedU128<FracSrc>
source§fn saturating_cast(self) -> FixedI128<FracDst>
fn saturating_cast(self) -> FixedI128<FracDst>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU16> SaturatingCast<FixedI16<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU16> SaturatingCast<FixedI16<FracDst>> for FixedU128<FracSrc>
source§fn saturating_cast(self) -> FixedI16<FracDst>
fn saturating_cast(self) -> FixedI16<FracDst>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU32> SaturatingCast<FixedI32<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU32> SaturatingCast<FixedI32<FracDst>> for FixedU128<FracSrc>
source§fn saturating_cast(self) -> FixedI32<FracDst>
fn saturating_cast(self) -> FixedI32<FracDst>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU64> SaturatingCast<FixedI64<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU64> SaturatingCast<FixedI64<FracDst>> for FixedU128<FracSrc>
source§fn saturating_cast(self) -> FixedI64<FracDst>
fn saturating_cast(self) -> FixedI64<FracDst>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU8> SaturatingCast<FixedI8<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU8> SaturatingCast<FixedI8<FracDst>> for FixedU128<FracSrc>
source§fn saturating_cast(self) -> FixedI8<FracDst>
fn saturating_cast(self) -> FixedI8<FracDst>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for bf16
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for bf16
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for bool
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for bool
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for f16
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for f16
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for f32
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for f32
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for f64
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for f64
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for i128
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for i128
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for i16
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for i16
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for i32
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for i32
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for i64
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for i64
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for i8
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for i8
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for isize
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for isize
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for u128
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for u128
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for u16
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for u16
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for u32
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for u32
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for u64
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for u64
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for u8
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for u8
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for usize
impl<Frac: LeEqU128> SaturatingCast<FixedU128<Frac>> for usize
source§fn saturating_cast(self) -> FixedU128<Frac>
fn saturating_cast(self) -> FixedU128<Frac>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedI128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedI128<FracSrc>
source§fn saturating_cast(self) -> FixedU128<FracDst>
fn saturating_cast(self) -> FixedU128<FracDst>
source§impl<FracSrc: LeEqU16, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedI16<FracSrc>
impl<FracSrc: LeEqU16, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedI16<FracSrc>
source§fn saturating_cast(self) -> FixedU128<FracDst>
fn saturating_cast(self) -> FixedU128<FracDst>
source§impl<FracSrc: LeEqU32, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedI32<FracSrc>
impl<FracSrc: LeEqU32, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedI32<FracSrc>
source§fn saturating_cast(self) -> FixedU128<FracDst>
fn saturating_cast(self) -> FixedU128<FracDst>
source§impl<FracSrc: LeEqU64, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedI64<FracSrc>
impl<FracSrc: LeEqU64, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedI64<FracSrc>
source§fn saturating_cast(self) -> FixedU128<FracDst>
fn saturating_cast(self) -> FixedU128<FracDst>
source§impl<FracSrc: LeEqU8, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedI8<FracSrc>
impl<FracSrc: LeEqU8, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedI8<FracSrc>
source§fn saturating_cast(self) -> FixedU128<FracDst>
fn saturating_cast(self) -> FixedU128<FracDst>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedU128<FracSrc>
source§fn saturating_cast(self) -> FixedU128<FracDst>
fn saturating_cast(self) -> FixedU128<FracDst>
source§impl<FracSrc: LeEqU16, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedU16<FracSrc>
impl<FracSrc: LeEqU16, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedU16<FracSrc>
source§fn saturating_cast(self) -> FixedU128<FracDst>
fn saturating_cast(self) -> FixedU128<FracDst>
source§impl<FracSrc: LeEqU32, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedU32<FracSrc>
impl<FracSrc: LeEqU32, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedU32<FracSrc>
source§fn saturating_cast(self) -> FixedU128<FracDst>
fn saturating_cast(self) -> FixedU128<FracDst>
source§impl<FracSrc: LeEqU64, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedU64<FracSrc>
impl<FracSrc: LeEqU64, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedU64<FracSrc>
source§fn saturating_cast(self) -> FixedU128<FracDst>
fn saturating_cast(self) -> FixedU128<FracDst>
source§impl<FracSrc: LeEqU8, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedU8<FracSrc>
impl<FracSrc: LeEqU8, FracDst: LeEqU128> SaturatingCast<FixedU128<FracDst>> for FixedU8<FracSrc>
source§fn saturating_cast(self) -> FixedU128<FracDst>
fn saturating_cast(self) -> FixedU128<FracDst>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU16> SaturatingCast<FixedU16<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU16> SaturatingCast<FixedU16<FracDst>> for FixedU128<FracSrc>
source§fn saturating_cast(self) -> FixedU16<FracDst>
fn saturating_cast(self) -> FixedU16<FracDst>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU32> SaturatingCast<FixedU32<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU32> SaturatingCast<FixedU32<FracDst>> for FixedU128<FracSrc>
source§fn saturating_cast(self) -> FixedU32<FracDst>
fn saturating_cast(self) -> FixedU32<FracDst>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU64> SaturatingCast<FixedU64<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU64> SaturatingCast<FixedU64<FracDst>> for FixedU128<FracSrc>
source§fn saturating_cast(self) -> FixedU64<FracDst>
fn saturating_cast(self) -> FixedU64<FracDst>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU8> SaturatingCast<FixedU8<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU8> SaturatingCast<FixedU8<FracDst>> for FixedU128<FracSrc>
source§fn saturating_cast(self) -> FixedU8<FracDst>
fn saturating_cast(self) -> FixedU8<FracDst>
source§impl<Frac: LeEqU128> SaturatingCast<bf16> for FixedU128<Frac>
impl<Frac: LeEqU128> SaturatingCast<bf16> for FixedU128<Frac>
source§fn saturating_cast(self) -> bf16
fn saturating_cast(self) -> bf16
source§impl<Frac: LeEqU128> SaturatingCast<f16> for FixedU128<Frac>
impl<Frac: LeEqU128> SaturatingCast<f16> for FixedU128<Frac>
source§fn saturating_cast(self) -> f16
fn saturating_cast(self) -> f16
source§impl<Frac: LeEqU128> SaturatingCast<f32> for FixedU128<Frac>
impl<Frac: LeEqU128> SaturatingCast<f32> for FixedU128<Frac>
source§fn saturating_cast(self) -> f32
fn saturating_cast(self) -> f32
source§impl<Frac: LeEqU128> SaturatingCast<f64> for FixedU128<Frac>
impl<Frac: LeEqU128> SaturatingCast<f64> for FixedU128<Frac>
source§fn saturating_cast(self) -> f64
fn saturating_cast(self) -> f64
source§impl<Frac: LeEqU128> SaturatingCast<i128> for FixedU128<Frac>
impl<Frac: LeEqU128> SaturatingCast<i128> for FixedU128<Frac>
source§fn saturating_cast(self) -> i128
fn saturating_cast(self) -> i128
source§impl<Frac: LeEqU128> SaturatingCast<i16> for FixedU128<Frac>
impl<Frac: LeEqU128> SaturatingCast<i16> for FixedU128<Frac>
source§fn saturating_cast(self) -> i16
fn saturating_cast(self) -> i16
source§impl<Frac: LeEqU128> SaturatingCast<i32> for FixedU128<Frac>
impl<Frac: LeEqU128> SaturatingCast<i32> for FixedU128<Frac>
source§fn saturating_cast(self) -> i32
fn saturating_cast(self) -> i32
source§impl<Frac: LeEqU128> SaturatingCast<i64> for FixedU128<Frac>
impl<Frac: LeEqU128> SaturatingCast<i64> for FixedU128<Frac>
source§fn saturating_cast(self) -> i64
fn saturating_cast(self) -> i64
source§impl<Frac: LeEqU128> SaturatingCast<i8> for FixedU128<Frac>
impl<Frac: LeEqU128> SaturatingCast<i8> for FixedU128<Frac>
source§fn saturating_cast(self) -> i8
fn saturating_cast(self) -> i8
source§impl<Frac: LeEqU128> SaturatingCast<isize> for FixedU128<Frac>
impl<Frac: LeEqU128> SaturatingCast<isize> for FixedU128<Frac>
source§fn saturating_cast(self) -> isize
fn saturating_cast(self) -> isize
source§impl<Frac: LeEqU128> SaturatingCast<u128> for FixedU128<Frac>
impl<Frac: LeEqU128> SaturatingCast<u128> for FixedU128<Frac>
source§fn saturating_cast(self) -> u128
fn saturating_cast(self) -> u128
source§impl<Frac: LeEqU128> SaturatingCast<u16> for FixedU128<Frac>
impl<Frac: LeEqU128> SaturatingCast<u16> for FixedU128<Frac>
source§fn saturating_cast(self) -> u16
fn saturating_cast(self) -> u16
source§impl<Frac: LeEqU128> SaturatingCast<u32> for FixedU128<Frac>
impl<Frac: LeEqU128> SaturatingCast<u32> for FixedU128<Frac>
source§fn saturating_cast(self) -> u32
fn saturating_cast(self) -> u32
source§impl<Frac: LeEqU128> SaturatingCast<u64> for FixedU128<Frac>
impl<Frac: LeEqU128> SaturatingCast<u64> for FixedU128<Frac>
source§fn saturating_cast(self) -> u64
fn saturating_cast(self) -> u64
source§impl<Frac: LeEqU128> SaturatingCast<u8> for FixedU128<Frac>
impl<Frac: LeEqU128> SaturatingCast<u8> for FixedU128<Frac>
source§fn saturating_cast(self) -> u8
fn saturating_cast(self) -> u8
source§impl<Frac: LeEqU128> SaturatingCast<usize> for FixedU128<Frac>
impl<Frac: LeEqU128> SaturatingCast<usize> for FixedU128<Frac>
source§fn saturating_cast(self) -> usize
fn saturating_cast(self) -> usize
source§impl<'a, Frac> ShlAssign<&'a i128> for FixedU128<Frac>
impl<'a, Frac> ShlAssign<&'a i128> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: &i128)
fn shl_assign(&mut self, rhs: &i128)
<<=
operation. Read moresource§impl<'a, Frac> ShlAssign<&'a i16> for FixedU128<Frac>
impl<'a, Frac> ShlAssign<&'a i16> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: &i16)
fn shl_assign(&mut self, rhs: &i16)
<<=
operation. Read moresource§impl<'a, Frac> ShlAssign<&'a i32> for FixedU128<Frac>
impl<'a, Frac> ShlAssign<&'a i32> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: &i32)
fn shl_assign(&mut self, rhs: &i32)
<<=
operation. Read moresource§impl<'a, Frac> ShlAssign<&'a i64> for FixedU128<Frac>
impl<'a, Frac> ShlAssign<&'a i64> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: &i64)
fn shl_assign(&mut self, rhs: &i64)
<<=
operation. Read moresource§impl<'a, Frac> ShlAssign<&'a i8> for FixedU128<Frac>
impl<'a, Frac> ShlAssign<&'a i8> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: &i8)
fn shl_assign(&mut self, rhs: &i8)
<<=
operation. Read moresource§impl<'a, Frac> ShlAssign<&'a isize> for FixedU128<Frac>
impl<'a, Frac> ShlAssign<&'a isize> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: &isize)
fn shl_assign(&mut self, rhs: &isize)
<<=
operation. Read moresource§impl<'a, Frac> ShlAssign<&'a u128> for FixedU128<Frac>
impl<'a, Frac> ShlAssign<&'a u128> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: &u128)
fn shl_assign(&mut self, rhs: &u128)
<<=
operation. Read moresource§impl<'a, Frac> ShlAssign<&'a u16> for FixedU128<Frac>
impl<'a, Frac> ShlAssign<&'a u16> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: &u16)
fn shl_assign(&mut self, rhs: &u16)
<<=
operation. Read moresource§impl<'a, Frac> ShlAssign<&'a u32> for FixedU128<Frac>
impl<'a, Frac> ShlAssign<&'a u32> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: &u32)
fn shl_assign(&mut self, rhs: &u32)
<<=
operation. Read moresource§impl<'a, Frac> ShlAssign<&'a u64> for FixedU128<Frac>
impl<'a, Frac> ShlAssign<&'a u64> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: &u64)
fn shl_assign(&mut self, rhs: &u64)
<<=
operation. Read moresource§impl<'a, Frac> ShlAssign<&'a u8> for FixedU128<Frac>
impl<'a, Frac> ShlAssign<&'a u8> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: &u8)
fn shl_assign(&mut self, rhs: &u8)
<<=
operation. Read moresource§impl<'a, Frac> ShlAssign<&'a usize> for FixedU128<Frac>
impl<'a, Frac> ShlAssign<&'a usize> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: &usize)
fn shl_assign(&mut self, rhs: &usize)
<<=
operation. Read moresource§impl<Frac> ShlAssign<i128> for FixedU128<Frac>
impl<Frac> ShlAssign<i128> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: i128)
fn shl_assign(&mut self, rhs: i128)
<<=
operation. Read moresource§impl<Frac> ShlAssign<i16> for FixedU128<Frac>
impl<Frac> ShlAssign<i16> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: i16)
fn shl_assign(&mut self, rhs: i16)
<<=
operation. Read moresource§impl<Frac> ShlAssign<i32> for FixedU128<Frac>
impl<Frac> ShlAssign<i32> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: i32)
fn shl_assign(&mut self, rhs: i32)
<<=
operation. Read moresource§impl<Frac> ShlAssign<i64> for FixedU128<Frac>
impl<Frac> ShlAssign<i64> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: i64)
fn shl_assign(&mut self, rhs: i64)
<<=
operation. Read moresource§impl<Frac> ShlAssign<i8> for FixedU128<Frac>
impl<Frac> ShlAssign<i8> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: i8)
fn shl_assign(&mut self, rhs: i8)
<<=
operation. Read moresource§impl<Frac> ShlAssign<isize> for FixedU128<Frac>
impl<Frac> ShlAssign<isize> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: isize)
fn shl_assign(&mut self, rhs: isize)
<<=
operation. Read moresource§impl<Frac> ShlAssign<u128> for FixedU128<Frac>
impl<Frac> ShlAssign<u128> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: u128)
fn shl_assign(&mut self, rhs: u128)
<<=
operation. Read moresource§impl<Frac> ShlAssign<u16> for FixedU128<Frac>
impl<Frac> ShlAssign<u16> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: u16)
fn shl_assign(&mut self, rhs: u16)
<<=
operation. Read moresource§impl<Frac> ShlAssign<u32> for FixedU128<Frac>
impl<Frac> ShlAssign<u32> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: u32)
fn shl_assign(&mut self, rhs: u32)
<<=
operation. Read moresource§impl<Frac> ShlAssign<u64> for FixedU128<Frac>
impl<Frac> ShlAssign<u64> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: u64)
fn shl_assign(&mut self, rhs: u64)
<<=
operation. Read moresource§impl<Frac> ShlAssign<u8> for FixedU128<Frac>
impl<Frac> ShlAssign<u8> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: u8)
fn shl_assign(&mut self, rhs: u8)
<<=
operation. Read moresource§impl<Frac> ShlAssign<usize> for FixedU128<Frac>
impl<Frac> ShlAssign<usize> for FixedU128<Frac>
source§fn shl_assign(&mut self, rhs: usize)
fn shl_assign(&mut self, rhs: usize)
<<=
operation. Read moresource§impl<'a, Frac> ShrAssign<&'a i128> for FixedU128<Frac>
impl<'a, Frac> ShrAssign<&'a i128> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: &i128)
fn shr_assign(&mut self, rhs: &i128)
>>=
operation. Read moresource§impl<'a, Frac> ShrAssign<&'a i16> for FixedU128<Frac>
impl<'a, Frac> ShrAssign<&'a i16> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: &i16)
fn shr_assign(&mut self, rhs: &i16)
>>=
operation. Read moresource§impl<'a, Frac> ShrAssign<&'a i32> for FixedU128<Frac>
impl<'a, Frac> ShrAssign<&'a i32> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: &i32)
fn shr_assign(&mut self, rhs: &i32)
>>=
operation. Read moresource§impl<'a, Frac> ShrAssign<&'a i64> for FixedU128<Frac>
impl<'a, Frac> ShrAssign<&'a i64> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: &i64)
fn shr_assign(&mut self, rhs: &i64)
>>=
operation. Read moresource§impl<'a, Frac> ShrAssign<&'a i8> for FixedU128<Frac>
impl<'a, Frac> ShrAssign<&'a i8> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: &i8)
fn shr_assign(&mut self, rhs: &i8)
>>=
operation. Read moresource§impl<'a, Frac> ShrAssign<&'a isize> for FixedU128<Frac>
impl<'a, Frac> ShrAssign<&'a isize> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: &isize)
fn shr_assign(&mut self, rhs: &isize)
>>=
operation. Read moresource§impl<'a, Frac> ShrAssign<&'a u128> for FixedU128<Frac>
impl<'a, Frac> ShrAssign<&'a u128> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: &u128)
fn shr_assign(&mut self, rhs: &u128)
>>=
operation. Read moresource§impl<'a, Frac> ShrAssign<&'a u16> for FixedU128<Frac>
impl<'a, Frac> ShrAssign<&'a u16> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: &u16)
fn shr_assign(&mut self, rhs: &u16)
>>=
operation. Read moresource§impl<'a, Frac> ShrAssign<&'a u32> for FixedU128<Frac>
impl<'a, Frac> ShrAssign<&'a u32> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: &u32)
fn shr_assign(&mut self, rhs: &u32)
>>=
operation. Read moresource§impl<'a, Frac> ShrAssign<&'a u64> for FixedU128<Frac>
impl<'a, Frac> ShrAssign<&'a u64> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: &u64)
fn shr_assign(&mut self, rhs: &u64)
>>=
operation. Read moresource§impl<'a, Frac> ShrAssign<&'a u8> for FixedU128<Frac>
impl<'a, Frac> ShrAssign<&'a u8> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: &u8)
fn shr_assign(&mut self, rhs: &u8)
>>=
operation. Read moresource§impl<'a, Frac> ShrAssign<&'a usize> for FixedU128<Frac>
impl<'a, Frac> ShrAssign<&'a usize> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: &usize)
fn shr_assign(&mut self, rhs: &usize)
>>=
operation. Read moresource§impl<Frac> ShrAssign<i128> for FixedU128<Frac>
impl<Frac> ShrAssign<i128> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: i128)
fn shr_assign(&mut self, rhs: i128)
>>=
operation. Read moresource§impl<Frac> ShrAssign<i16> for FixedU128<Frac>
impl<Frac> ShrAssign<i16> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: i16)
fn shr_assign(&mut self, rhs: i16)
>>=
operation. Read moresource§impl<Frac> ShrAssign<i32> for FixedU128<Frac>
impl<Frac> ShrAssign<i32> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: i32)
fn shr_assign(&mut self, rhs: i32)
>>=
operation. Read moresource§impl<Frac> ShrAssign<i64> for FixedU128<Frac>
impl<Frac> ShrAssign<i64> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: i64)
fn shr_assign(&mut self, rhs: i64)
>>=
operation. Read moresource§impl<Frac> ShrAssign<i8> for FixedU128<Frac>
impl<Frac> ShrAssign<i8> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: i8)
fn shr_assign(&mut self, rhs: i8)
>>=
operation. Read moresource§impl<Frac> ShrAssign<isize> for FixedU128<Frac>
impl<Frac> ShrAssign<isize> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: isize)
fn shr_assign(&mut self, rhs: isize)
>>=
operation. Read moresource§impl<Frac> ShrAssign<u128> for FixedU128<Frac>
impl<Frac> ShrAssign<u128> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: u128)
fn shr_assign(&mut self, rhs: u128)
>>=
operation. Read moresource§impl<Frac> ShrAssign<u16> for FixedU128<Frac>
impl<Frac> ShrAssign<u16> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: u16)
fn shr_assign(&mut self, rhs: u16)
>>=
operation. Read moresource§impl<Frac> ShrAssign<u32> for FixedU128<Frac>
impl<Frac> ShrAssign<u32> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: u32)
fn shr_assign(&mut self, rhs: u32)
>>=
operation. Read moresource§impl<Frac> ShrAssign<u64> for FixedU128<Frac>
impl<Frac> ShrAssign<u64> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: u64)
fn shr_assign(&mut self, rhs: u64)
>>=
operation. Read moresource§impl<Frac> ShrAssign<u8> for FixedU128<Frac>
impl<Frac> ShrAssign<u8> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: u8)
fn shr_assign(&mut self, rhs: u8)
>>=
operation. Read moresource§impl<Frac> ShrAssign<usize> for FixedU128<Frac>
impl<Frac> ShrAssign<usize> for FixedU128<Frac>
source§fn shr_assign(&mut self, rhs: usize)
fn shr_assign(&mut self, rhs: usize)
>>=
operation. Read moresource§impl<FracSrc: LeEqU128, FracDst: LeEqU128> StaticCast<FixedI128<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU128> StaticCast<FixedI128<FracDst>> for FixedU128<FracSrc>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU16> StaticCast<FixedI16<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU16> StaticCast<FixedI16<FracDst>> for FixedU128<FracSrc>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU32> StaticCast<FixedI32<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU32> StaticCast<FixedI32<FracDst>> for FixedU128<FracSrc>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU64> StaticCast<FixedI64<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU64> StaticCast<FixedI64<FracDst>> for FixedU128<FracSrc>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU128> StaticCast<FixedU128<FracDst>> for FixedI128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU128> StaticCast<FixedU128<FracDst>> for FixedI128<FracSrc>
source§impl<FracSrc: LeEqU16, FracDst: LeEqU128> StaticCast<FixedU128<FracDst>> for FixedI16<FracSrc>
impl<FracSrc: LeEqU16, FracDst: LeEqU128> StaticCast<FixedU128<FracDst>> for FixedI16<FracSrc>
source§impl<FracSrc: LeEqU32, FracDst: LeEqU128> StaticCast<FixedU128<FracDst>> for FixedI32<FracSrc>
impl<FracSrc: LeEqU32, FracDst: LeEqU128> StaticCast<FixedU128<FracDst>> for FixedI32<FracSrc>
source§impl<FracSrc: LeEqU64, FracDst: LeEqU128> StaticCast<FixedU128<FracDst>> for FixedI64<FracSrc>
impl<FracSrc: LeEqU64, FracDst: LeEqU128> StaticCast<FixedU128<FracDst>> for FixedI64<FracSrc>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU128> StaticCast<FixedU128<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU128> StaticCast<FixedU128<FracDst>> for FixedU128<FracSrc>
source§impl<FracSrc: LeEqU16, FracDst: LeEqU128> StaticCast<FixedU128<FracDst>> for FixedU16<FracSrc>
impl<FracSrc: LeEqU16, FracDst: LeEqU128> StaticCast<FixedU128<FracDst>> for FixedU16<FracSrc>
source§impl<FracSrc: LeEqU32, FracDst: LeEqU128> StaticCast<FixedU128<FracDst>> for FixedU32<FracSrc>
impl<FracSrc: LeEqU32, FracDst: LeEqU128> StaticCast<FixedU128<FracDst>> for FixedU32<FracSrc>
source§impl<FracSrc: LeEqU64, FracDst: LeEqU128> StaticCast<FixedU128<FracDst>> for FixedU64<FracSrc>
impl<FracSrc: LeEqU64, FracDst: LeEqU128> StaticCast<FixedU128<FracDst>> for FixedU64<FracSrc>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU16> StaticCast<FixedU16<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU16> StaticCast<FixedU16<FracDst>> for FixedU128<FracSrc>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU32> StaticCast<FixedU32<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU32> StaticCast<FixedU32<FracDst>> for FixedU128<FracSrc>
source§impl<FracSrc: LeEqU128, FracDst: LeEqU64> StaticCast<FixedU64<FracDst>> for FixedU128<FracSrc>
impl<FracSrc: LeEqU128, FracDst: LeEqU64> StaticCast<FixedU64<FracDst>> for FixedU128<FracSrc>
source§impl<'a, Frac> SubAssign<&'a FixedU128<Frac>> for FixedU128<Frac>
impl<'a, Frac> SubAssign<&'a FixedU128<Frac>> for FixedU128<Frac>
source§fn sub_assign(&mut self, rhs: &FixedU128<Frac>)
fn sub_assign(&mut self, rhs: &FixedU128<Frac>)
-=
operation. Read moresource§impl<Frac> SubAssign for FixedU128<Frac>
impl<Frac> SubAssign for FixedU128<Frac>
source§fn sub_assign(&mut self, rhs: FixedU128<Frac>)
fn sub_assign(&mut self, rhs: FixedU128<Frac>)
-=
operation. Read moresource§impl<Frac: LeEqU128> ToFixed for FixedU128<Frac>
impl<Frac: LeEqU128> ToFixed for FixedU128<Frac>
source§fn to_fixed<F: Fixed>(self) -> F
fn to_fixed<F: Fixed>(self) -> F
Converts a fixed-point number.
Any extra fractional bits are truncated.
source§fn checked_to_fixed<F: Fixed>(self) -> Option<F>
fn checked_to_fixed<F: Fixed>(self) -> Option<F>
Converts a fixed-point number if it fits, otherwise returns None
.
Any extra fractional bits are truncated.
source§fn saturating_to_fixed<F: Fixed>(self) -> F
fn saturating_to_fixed<F: Fixed>(self) -> F
Converts a fixed-point number, saturating if it does not fit.
Any extra fractional bits are truncated.
source§fn wrapping_to_fixed<F: Fixed>(self) -> F
fn wrapping_to_fixed<F: Fixed>(self) -> F
Converts a fixed-point number, wrapping if it does not fit.
Any extra fractional bits are truncated.