Struct fixed::Saturating
source · #[repr(transparent)]pub struct Saturating<F>(pub F);
Expand description
Provides saturating arithmetic on fixed-point numbers.
The underlying value can be retrieved through the .0
index.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let max = Saturating(I16F16::MAX);
let delta = Saturating(I16F16::DELTA);
assert_eq!(I16F16::MAX, (max + delta).0);
Tuple Fields§
§0: F
Implementations§
source§impl<F: Fixed> Saturating<F>
impl<F: Fixed> Saturating<F>
sourcepub const ZERO: Saturating<F> = _
pub const ZERO: Saturating<F> = _
sourcepub const DELTA: Saturating<F> = _
pub const DELTA: Saturating<F> = _
sourcepub const MIN: Saturating<F> = _
pub const MIN: Saturating<F> = _
sourcepub const MAX: Saturating<F> = _
pub const MAX: Saturating<F> = _
sourcepub fn from_bits(bits: F::Bits) -> Saturating<F>
pub fn from_bits(bits: F::Bits) -> Saturating<F>
Creates a fixed-point number that has a bitwise representation identical to the given integer.
See also FixedI32::from_bits
and
FixedU32::from_bits
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
assert_eq!(Saturating::<I16F16>::from_bits(0x1C), Saturating(I16F16::from_bits(0x1C)));
sourcepub fn to_bits(self) -> F::Bits
pub fn to_bits(self) -> F::Bits
Creates an integer that has a bitwise representation identical to the given fixed-point number.
See also FixedI32::to_bits
and
FixedU32::to_bits
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let w = Saturating(I16F16::from_bits(0x1C));
assert_eq!(w.to_bits(), 0x1C);
sourcepub fn from_be(w: Self) -> Self
pub fn from_be(w: Self) -> Self
Converts a fixed-point number from big endian to the target’s endianness.
See also FixedI32::from_be
and
FixedU32::from_be
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let w = Saturating(I16F16::from_bits(0x1234_5678));
if cfg!(target_endian = "big") {
assert_eq!(Saturating::from_be(w), w);
} else {
assert_eq!(Saturating::from_be(w), w.swap_bytes());
}
sourcepub fn from_le(w: Self) -> Self
pub fn from_le(w: Self) -> Self
Converts a fixed-point number from little endian to the target’s endianness.
See also FixedI32::from_le
and
FixedU32::from_le
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let w = Saturating(I16F16::from_bits(0x1234_5678));
if cfg!(target_endian = "little") {
assert_eq!(Saturating::from_le(w), w);
} else {
assert_eq!(Saturating::from_le(w), w.swap_bytes());
}
sourcepub fn to_be(self) -> Self
pub fn to_be(self) -> Self
Converts self
to big endian from the target’s endianness.
See also FixedI32::to_be
and
FixedU32::to_be
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let w = Saturating(I16F16::from_bits(0x1234_5678));
if cfg!(target_endian = "big") {
assert_eq!(w.to_be(), w);
} else {
assert_eq!(w.to_be(), w.swap_bytes());
}
sourcepub fn to_le(self) -> Self
pub fn to_le(self) -> Self
Converts self
to little endian from the target’s endianness.
See also FixedI32::to_le
and
FixedU32::to_le
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let w = Saturating(I16F16::from_bits(0x1234_5678));
if cfg!(target_endian = "little") {
assert_eq!(w.to_le(), w);
} else {
assert_eq!(w.to_le(), w.swap_bytes());
}
sourcepub fn swap_bytes(self) -> Self
pub fn swap_bytes(self) -> Self
Reverses the byte order of the fixed-point number.
See also FixedI32::swap_bytes
and
FixedU32::swap_bytes
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let w = Saturating(I16F16::from_bits(0x1234_5678));
let swapped = Saturating(I16F16::from_bits(0x7856_3412));
assert_eq!(w.swap_bytes(), swapped);
sourcepub fn from_be_bytes(bytes: [u8; { _ }]) -> Self
pub fn from_be_bytes(bytes: [u8; { _ }]) -> Self
Creates a fixed-point number from its representation as a byte array in big endian.
See also
FixedI32::from_be_bytes
and
FixedU32::from_be_bytes
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let bytes = [0x12, 0x34, 0x56, 0x78];
assert_eq!(
Saturating::<I16F16>::from_be_bytes(bytes),
Saturating::<I16F16>::from_bits(0x1234_5678)
);
sourcepub fn from_le_bytes(bytes: [u8; { _ }]) -> Self
pub fn from_le_bytes(bytes: [u8; { _ }]) -> Self
Creates a fixed-point number from its representation as a byte array in little endian.
See also
FixedI32::from_le_bytes
and
FixedU32::from_le_bytes
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let bytes = [0x78, 0x56, 0x34, 0x12];
assert_eq!(
Saturating::<I16F16>::from_le_bytes(bytes),
Saturating::<I16F16>::from_bits(0x1234_5678)
);
sourcepub fn from_ne_bytes(bytes: [u8; { _ }]) -> Self
pub fn from_ne_bytes(bytes: [u8; { _ }]) -> Self
Creates a fixed-point number from its representation as a byte array in native endian.
See also
FixedI32::from_ne_bytes
and
FixedU32::from_ne_bytes
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let bytes = if cfg!(target_endian = "big") {
[0x12, 0x34, 0x56, 0x78]
} else {
[0x78, 0x56, 0x34, 0x12]
};
assert_eq!(
Saturating::<I16F16>::from_ne_bytes(bytes),
Saturating::<I16F16>::from_bits(0x1234_5678)
);
sourcepub fn to_be_bytes(self) -> [u8; { _ }]
pub fn to_be_bytes(self) -> [u8; { _ }]
Returns the memory representation of this fixed-point number as a byte array in big-endian byte order.
See also FixedI32::to_be_bytes
and FixedU32::to_be_bytes
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
assert_eq!(
Saturating::<I16F16>::from_bits(0x1234_5678).to_be_bytes(),
[0x12, 0x34, 0x56, 0x78]
);
sourcepub fn to_le_bytes(self) -> [u8; { _ }]
pub fn to_le_bytes(self) -> [u8; { _ }]
Returns the memory representation of this fixed-point number as a byte array in little-endian byte order.
See also FixedI32::to_le_bytes
and FixedU32::to_le_bytes
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
assert_eq!(
Saturating::<I16F16>::from_bits(0x1234_5678).to_le_bytes(),
[0x78, 0x56, 0x34, 0x12]
);
sourcepub fn to_ne_bytes(self) -> [u8; { _ }]
pub fn to_ne_bytes(self) -> [u8; { _ }]
Returns the memory representation of this fixed-point number as a byte array in native-endian byte order.
See also FixedI32::to_ne_bytes
and FixedU32::to_ne_bytes
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let bytes = if cfg!(target_endian = "big") {
[0x12, 0x34, 0x56, 0x78]
} else {
[0x78, 0x56, 0x34, 0x12]
};
assert_eq!(
Saturating::<I16F16>::from_bits(0x1234_5678).to_ne_bytes(),
bytes
);
sourcepub fn from_num<Src: ToFixed>(src: Src) -> Saturating<F>
pub fn from_num<Src: ToFixed>(src: Src) -> Saturating<F>
Saturating conversion from another number.
The other number can be:
- A fixed-point number. Any extra fractional bits are discarded, which rounds towards −∞.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. - A floating-point number of type
f16
,bf16
,f32
,f64
orF128
. 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 returnsSaturating(src.saturating_to_fixed())
.
See also
FixedI32::saturating_from_num
and
FixedU32::saturating_from_num
.
§Panics
For floating-point numbers, panics if the value is NaN.
§Examples
#![feature(generic_const_exprs)]
use fixed::{
types::{I4F4, I16F16},
Saturating,
};
let src = I16F16::from_bits(0x1234_5678);
let dst = Saturating::<I4F4>::from_num(src);
assert_eq!(dst, Saturating(I4F4::MAX));
let src_int = 0x1234_i32;
let dst_int = Saturating::<I4F4>::from_num(src_int);
assert_eq!(dst_int, Saturating(I4F4::MAX));
let src_float = f64::NEG_INFINITY;
let dst_float = Saturating::<I4F4>::from_num(src_float);
assert_eq!(dst_float, Saturating(I4F4::MIN));
sourcepub fn to_num<Dst: FromFixed>(self) -> Dst
pub fn to_num<Dst: FromFixed>(self) -> Dst
Converts a fixed-point number to another number, saturating the value on overflow.
The other number can be:
- Another fixed-point number. Any extra fractional bits are discarded, which rounds towards −∞.
- An integer of type
i8
,i16
,i32
,i64
,i128
,isize
,u8
,u16
,u32
,u64
,u128
, orusize
. Any fractional bits are discarded, which rounds towards −∞. - A floating-point number of type
f16
,bf16
,f32
,f64
orF128
. 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.0)
.
See also FixedI32::saturating_to_num
and
FixedU32::saturating_to_num
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{
types::{I16F16, I2F6, I4F4},
Saturating,
};
// conversion that fits
let src = Saturating(I4F4::from_num(1.75));
let expected = I16F16::from_num(1.75);
assert_eq!(src.to_num::<I16F16>(), expected);
// conversion that saturates
let src = Saturating(I4F4::MAX);
assert_eq!(src.to_num::<I2F6>(), I2F6::MAX);
sourcepub fn int(self) -> Saturating<F>
pub fn int(self) -> Saturating<F>
Returns the integer part.
Note that since the numbers are stored in two’s complement,
negative numbers with non-zero fractional parts will be
rounded towards −∞, except in the case where there are no
integer bits, for example for the type
Saturating<I0F16>
, where the return value
is always zero.
See also FixedI32::int
and
FixedU32::int
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
assert_eq!(Saturating(I16F16::from_num(12.25)).int(), Saturating(I16F16::from_num(12)));
assert_eq!(Saturating(I16F16::from_num(-12.25)).int(), Saturating(I16F16::from_num(-13)));
sourcepub fn frac(self) -> Saturating<F>
pub fn frac(self) -> Saturating<F>
Returns the fractional part.
Note that since the numbers are stored in two’s complement,
the returned fraction will be non-negative for negative
numbers, except in the case where there are no integer bits,
for example for the type
Saturating<I0F16>
,
where the return value is always equal to self
.
See also FixedI32::frac
and
FixedU32::frac
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
assert_eq!(Saturating(I16F16::from_num(12.25)).frac(), Saturating(I16F16::from_num(0.25)));
assert_eq!(Saturating(I16F16::from_num(-12.25)).frac(), Saturating(I16F16::from_num(0.75)));
sourcepub fn round_to_zero(self) -> Saturating<F>
pub fn round_to_zero(self) -> Saturating<F>
Rounds to the next integer towards 0.
See also
FixedI32::round_to_zero
and
FixedU32::round_to_zero
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let three = Saturating(I16F16::from_num(3));
assert_eq!(Saturating(I16F16::from_num(3.9)).round_to_zero(), three);
assert_eq!(Saturating(I16F16::from_num(-3.9)).round_to_zero(), -three);
sourcepub fn ceil(self) -> Saturating<F>
pub fn ceil(self) -> Saturating<F>
Saturating ceil. Rounds to the next integer towards +∞, saturating on overflow.
See also
FixedI32::saturating_ceil
and
FixedU32::saturating_ceil
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let two_half = Saturating(I16F16::from_num(5) / 2);
assert_eq!(two_half.ceil(), Saturating(I16F16::from_num(3)));
assert_eq!(Saturating(I16F16::MAX).ceil(), Saturating(I16F16::MAX));
sourcepub fn floor(self) -> Saturating<F>
pub fn floor(self) -> Saturating<F>
Saturating floor. Rounds to the next integer towards −∞, saturating on overflow.
Overflow can only occur for signed numbers with zero integer bits.
See also
FixedI32::saturating_floor
and
FixedU32::saturating_floor
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{
types::{I0F32, I16F16},
Saturating,
};
let two_half = Saturating(I16F16::from_num(5) / 2);
assert_eq!(two_half.floor(), Saturating(I16F16::from_num(2)));
assert_eq!(Saturating(I0F32::MIN).floor(), Saturating(I0F32::MIN));
sourcepub fn round(self) -> Saturating<F>
pub fn round(self) -> Saturating<F>
Saturating round. Rounds to the next integer to the nearest, with ties rounded away from zero, and saturating on overflow.
See also
FixedI32::saturating_round
and
FixedU32::saturating_round
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let two_half = Saturating(I16F16::from_num(5) / 2);
assert_eq!(two_half.round(), Saturating(I16F16::from_num(3)));
assert_eq!((-two_half).round(), Saturating(I16F16::from_num(-3)));
let max = Saturating(I16F16::MAX);
assert_eq!(max.round(), max);
sourcepub fn round_ties_to_even(self) -> Saturating<F>
pub fn round_ties_to_even(self) -> Saturating<F>
Saturating round. Rounds to the next integer to the nearest, with ties rounded to even, and saturating on overflow.
See also
FixedI32::saturating_round_ties_to_even
and
FixedU32::saturating_round_ties_to_even
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let two_half = Saturating(I16F16::from_num(2.5));
assert_eq!(two_half.round_ties_to_even(), Saturating(I16F16::from_num(2)));
let three_half = Saturating(I16F16::from_num(3.5));
assert_eq!(three_half.round_ties_to_even(), Saturating(I16F16::from_num(4)));
let max = Saturating(I16F16::MAX);
assert_eq!(max.round_ties_to_even(), max);
sourcepub fn count_ones(self) -> u32
pub fn count_ones(self) -> u32
Returns the number of ones in the binary representation.
See also FixedI32::count_ones
and
FixedU32::count_ones
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let w = Saturating(I16F16::from_bits(0x00FF_FF00));
assert_eq!(w.count_ones(), w.0.count_ones());
sourcepub fn count_zeros(self) -> u32
pub fn count_zeros(self) -> u32
Returns the number of zeros in the binary representation.
See also FixedI32::count_zeros
and FixedU32::count_zeros
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let w = Saturating(I16F16::from_bits(0x00FF_FF00));
assert_eq!(w.count_zeros(), w.0.count_zeros());
sourcepub fn leading_ones(self) -> u32
pub fn leading_ones(self) -> u32
Returns the number of leading ones in the binary representation.
See also FixedI32::leading_ones
and FixedU32::leading_ones
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::U16F16, Saturating};
let w = Saturating(U16F16::from_bits(0xFF00_00FF));
assert_eq!(w.leading_ones(), w.0.leading_ones());
sourcepub fn leading_zeros(self) -> u32
pub fn leading_zeros(self) -> u32
Returns the number of leading zeros in the binary representation.
See also
FixedI32::leading_zeros
and
FixedU32::leading_zeros
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let w = Saturating(I16F16::from_bits(0x00FF_FF00));
assert_eq!(w.leading_zeros(), w.0.leading_zeros());
sourcepub fn trailing_ones(self) -> u32
pub fn trailing_ones(self) -> u32
Returns the number of trailing ones in the binary representation.
See also
FixedI32::trailing_ones
and
FixedU32::trailing_ones
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::U16F16, Saturating};
let w = Saturating(U16F16::from_bits(0xFF00_00FF));
assert_eq!(w.trailing_ones(), w.0.trailing_ones());
sourcepub fn trailing_zeros(self) -> u32
pub fn trailing_zeros(self) -> u32
Returns the number of trailing zeros in the binary representation.
See also
FixedI32::trailing_zeros
and
FixedU32::trailing_zeros
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let w = Saturating(I16F16::from_bits(0x00FF_FF00));
assert_eq!(w.trailing_zeros(), w.0.trailing_zeros());
sourcepub fn reverse_bits(self) -> Saturating<F>
pub fn reverse_bits(self) -> Saturating<F>
Reverses the order of the bits of the fixed-point number.
See also FixedI32::reverse_bits
and FixedU32::reverse_bits
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let i = I16F16::from_bits(0x1234_5678);
assert_eq!(Saturating(i).reverse_bits(), Saturating(i.reverse_bits()));
sourcepub fn rotate_left(self, n: u32) -> Saturating<F>
pub fn rotate_left(self, n: u32) -> Saturating<F>
Shifts to the left by n
bits, saturating the truncated bits to the right end.
See also FixedI32::rotate_left
and FixedU32::rotate_left
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let i = I16F16::from_bits(0x00FF_FF00);
assert_eq!(Saturating(i).rotate_left(12), Saturating(i.rotate_left(12)));
sourcepub fn rotate_right(self, n: u32) -> Saturating<F>
pub fn rotate_right(self, n: u32) -> Saturating<F>
Shifts to the right by n
bits, saturating the truncated bits to the left end.
See also FixedI32::rotate_right
and FixedU32::rotate_right
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let i = I16F16::from_bits(0x00FF_FF00);
assert_eq!(Saturating(i).rotate_right(12), Saturating(i.rotate_right(12)));
sourcepub fn dist(self, other: Saturating<F>) -> Saturating<F>
pub fn dist(self, other: Saturating<F>) -> Saturating<F>
Returns the distance from self
to other
.
See also
FixedI32::saturating_dist
and
FixedU32::saturating_dist
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
type Wr = Saturating<I16F16>;
assert_eq!(Wr::from_num(-1).dist(Wr::from_num(4)), Wr::from_num(5));
assert_eq!(Wr::MIN.dist(Wr::MAX), Wr::MAX);
sourcepub fn mean(self, other: Saturating<F>) -> Saturating<F>
pub fn mean(self, other: Saturating<F>) -> Saturating<F>
Returns the mean of self
and other
.
See also FixedI32::mean
and
FixedU32::mean
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let three = Saturating(I16F16::from_num(3));
let four = Saturating(I16F16::from_num(4));
assert_eq!(three.mean(four), Saturating(I16F16::from_num(3.5)));
assert_eq!(three.mean(-four), Saturating(I16F16::from_num(-0.5)));
sourcepub fn hypot(self, other: Saturating<F>) -> Saturating<F>
pub fn hypot(self, other: Saturating<F>) -> Saturating<F>
Compute the hypotenuse of a right triange.
See also
FixedI32::saturating_hypot
and
FixedU32::saturating_hypot
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I8F8, Saturating};
type Sa = Saturating<I8F8>;
// hypot(3, 4) == 5
assert_eq!(Sa::from_num(3).hypot(Sa::from_num(4)), Sa::from_num(5));
// hypot(88, 105) == 137, which saturates
assert_eq!(Sa::from_num(88).hypot(Sa::from_num(105)), Sa::MAX);
sourcepub fn next_multiple_of(self, other: Saturating<F>) -> Saturating<F>
pub fn next_multiple_of(self, other: Saturating<F>) -> Saturating<F>
Returns the next multiple of other
.
See also
FixedI32::saturating_next_multiple_of
and
FixedU32::saturating_next_multiple_of
.
§Panics
Panics if other
is zero.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let one_point_5 = Saturating::<I16F16>::from_num(1.5);
let four = Saturating::<I16F16>::from_num(4);
let four_point_5 = Saturating::<I16F16>::from_num(4.5);
assert_eq!(four.next_multiple_of(one_point_5), four_point_5);
let max = Saturating::<I16F16>::MAX;
let max_minus_delta = max - Saturating::<I16F16>::DELTA;
assert_eq!(max.next_multiple_of(max_minus_delta), max_minus_delta * 2);
sourcepub fn mul_add<const MUL_FRAC: i32>(
self,
mul: Saturating<<F::Bits as FixedBits>::Fixed<MUL_FRAC>>,
add: Saturating<F>
) -> Saturating<F>
pub fn mul_add<const MUL_FRAC: i32>( self, mul: Saturating<<F::Bits as FixedBits>::Fixed<MUL_FRAC>>, add: Saturating<F> ) -> Saturating<F>
Multiply and add. Returns self
× mul
+ add
.
See also
FixedI32::saturating_mul_add
and
FixedU32::saturating_mul_add
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let half = Saturating(I16F16::from_num(0.5));
let three = Saturating(I16F16::from_num(3));
let four = Saturating(I16F16::from_num(4));
let max = Saturating(I16F16::MAX);
assert_eq!(three.mul_add(half, four), Saturating(I16F16::from_num(5.5)));
assert_eq!(max.mul_add(three, max), max * 4);
sourcepub fn add_prod<const A_FRAC: i32, const B_FRAC: i32>(
self,
a: Saturating<<F::Bits as FixedBits>::Fixed<A_FRAC>>,
b: Saturating<<F::Bits as FixedBits>::Fixed<B_FRAC>>
) -> Saturating<F>
pub fn add_prod<const A_FRAC: i32, const B_FRAC: i32>( self, a: Saturating<<F::Bits as FixedBits>::Fixed<A_FRAC>>, b: Saturating<<F::Bits as FixedBits>::Fixed<B_FRAC>> ) -> Saturating<F>
Adds self
to the product a
× b
.
See also
FixedI32::saturating_add_prod
and
FixedU32::saturating_add_prod
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let half = Saturating(I16F16::from_num(0.5));
let three = Saturating(I16F16::from_num(3));
let four = Saturating(I16F16::from_num(4));
let max = Saturating(I16F16::MAX);
assert_eq!(four.add_prod(three, half), Saturating(I16F16::from_num(5.5)));
assert_eq!(max.add_prod(max, three), max * 4);
sourcepub fn mul_acc<const A_FRAC: i32, const B_FRAC: i32>(
&mut self,
a: Saturating<<F::Bits as FixedBits>::Fixed<A_FRAC>>,
b: Saturating<<F::Bits as FixedBits>::Fixed<B_FRAC>>
)
pub fn mul_acc<const A_FRAC: i32, const B_FRAC: i32>( &mut self, a: Saturating<<F::Bits as FixedBits>::Fixed<A_FRAC>>, b: Saturating<<F::Bits as FixedBits>::Fixed<B_FRAC>> )
Multiply and accumulate. Adds (a
× b
) to self
.
See also
FixedI32::saturating_mul_acc
and
FixedU32::saturating_mul_acc
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let mut acc = Saturating(I16F16::from_num(3));
acc.mul_acc(Saturating(I16F16::from_num(4)), Saturating(I16F16::from_num(0.5)));
assert_eq!(acc, Saturating(I16F16::from_num(5)));
acc = Saturating(I16F16::MAX);
acc.mul_acc(Saturating(I16F16::MAX), Saturating(I16F16::from_num(3)));
assert_eq!(acc, Saturating(I16F16::MAX) * 4);
sourcepub fn rem_euclid(self, divisor: Saturating<F>) -> Saturating<F>
pub fn rem_euclid(self, divisor: Saturating<F>) -> Saturating<F>
Remainder for Euclidean division.
See also FixedI32::rem_euclid
and
FixedU32::rem_euclid
.
§Panics
Panics if the divisor is zero.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let num = Saturating(I16F16::from_num(7.5));
let den = Saturating(I16F16::from_num(2));
assert_eq!(num.rem_euclid(den), Saturating(I16F16::from_num(1.5)));
assert_eq!((-num).rem_euclid(den), Saturating(I16F16::from_num(0.5)));
source§impl<F: FixedBoundFrac> Saturating<F>
impl<F: FixedBoundFrac> Saturating<F>
sourcepub fn from_str_binary(src: &str) -> Result<Saturating<F>, ParseFixedError>
pub fn from_str_binary(src: &str) -> Result<Saturating<F>, ParseFixedError>
Parses a string slice containing binary digits to return a fixed-point number.
Rounding is to the nearest, with ties rounded to even.
See also
FixedI32::saturating_from_str_binary
and
FixedU32::saturating_from_str_binary
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I8F8, Saturating};
let max = Saturating(I8F8::MAX);
assert_eq!(Saturating::<I8F8>::from_str_binary("101100111000.1"), Ok(max));
sourcepub fn from_str_octal(src: &str) -> Result<Saturating<F>, ParseFixedError>
pub fn from_str_octal(src: &str) -> Result<Saturating<F>, ParseFixedError>
Parses a string slice containing octal digits to return a fixed-point number.
Rounding is to the nearest, with ties rounded to even.
See also
FixedI32::saturating_from_str_octal
and
FixedU32::saturating_from_str_octal
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I8F8, Saturating};
let max = Saturating(I8F8::MAX);
assert_eq!(Saturating::<I8F8>::from_str_octal("7165.4"), Ok(max));
sourcepub fn from_str_hex(src: &str) -> Result<Saturating<F>, ParseFixedError>
pub fn from_str_hex(src: &str) -> Result<Saturating<F>, ParseFixedError>
Parses a string slice containing hexadecimal digits to return a fixed-point number.
Rounding is to the nearest, with ties rounded to even.
See also
FixedI32::saturating_from_str_hex
and
FixedU32::saturating_from_str_hex
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I8F8, Saturating};
let max = Saturating(I8F8::MAX);
assert_eq!(Saturating::<I8F8>::from_str_hex("C0F.FE"), Ok(max));
sourcepub fn sqrt(self) -> Self
pub fn sqrt(self) -> Self
Returns the square root.
See also
FixedI32::saturating_sqrt
and
FixedU32::saturating_sqrt
.
§Panics
Panics if the number is negative.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I0F32, Saturating};
assert_eq!(Saturating(I0F32::lit("0b0.0001")).sqrt().0, I0F32::lit("0b0.01"));
// This method handles the overflow corner case.
let s = Saturating(I0F32::from_num(0.25));
assert_eq!(s.sqrt().0, I0F32::MAX);
sourcepub fn recip(self) -> Saturating<F>
pub fn recip(self) -> Saturating<F>
Returns the reciprocal (inverse), 1/self
.
See also
FixedI32::saturating_recip
and
FixedU32::saturating_recip
.
§Panics
Panics if self
is zero.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I8F24, Saturating};
let quarter = Saturating(I8F24::from_num(0.25));
let frac_1_512 = Saturating(I8F24::ONE / 512);
assert_eq!(quarter.recip(), Saturating(I8F24::from_num(4)));
assert_eq!(frac_1_512.recip(), Saturating(I8F24::MAX));
sourcepub fn div_euclid(self, divisor: Saturating<F>) -> Saturating<F>
pub fn div_euclid(self, divisor: Saturating<F>) -> Saturating<F>
Euclidean division.
See also
FixedI32::saturating_div_euclid
and
FixedU32::saturating_div_euclid
.
§Panics
Panics if the divisor is zero.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let num = Saturating(I16F16::from_num(7.5));
let den = Saturating(I16F16::from_num(2));
assert_eq!(num.div_euclid(den), Saturating(I16F16::from_num(3)));
let quarter = Saturating(I16F16::from_num(0.25));
let max = Saturating(I16F16::MAX);
assert_eq!(max.div_euclid(quarter), max);
sourcepub fn div_euclid_int(self, divisor: F::Bits) -> Saturating<F>
pub fn div_euclid_int(self, divisor: F::Bits) -> Saturating<F>
Euclidean division by an integer.
See also
FixedI32::saturating_div_euclid_int
and
FixedU32::saturating_div_euclid_int
.
§Panics
Panics if the divisor is zero.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let num = Saturating(I16F16::from_num(7.5));
assert_eq!(num.div_euclid_int(2), Saturating(I16F16::from_num(3)));
let min = Saturating(I16F16::MIN);
let max = Saturating(I16F16::MAX);
assert_eq!(min.div_euclid_int(-1), max);
sourcepub fn rem_euclid_int(self, divisor: F::Bits) -> Saturating<F>
pub fn rem_euclid_int(self, divisor: F::Bits) -> Saturating<F>
Remainder for Euclidean division.
See also
FixedI32::saturating_rem_euclid_int
and
FixedU32::saturating_rem_euclid_int
.
§Panics
Panics if the divisor is zero.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
let num = Saturating(I16F16::from_num(7.5));
assert_eq!(num.rem_euclid_int(2), Saturating(I16F16::from_num(1.5)));
assert_eq!((-num).rem_euclid_int(2), Saturating(I16F16::from_num(0.5)));
sourcepub fn lerp(self, start: Saturating<F>, end: Saturating<F>) -> Saturating<F>
pub fn lerp(self, start: Saturating<F>, end: Saturating<F>) -> Saturating<F>
Linear interpolation between start
and end
.
See also
FixedI32::saturating_lerp
and
FixedU32::saturating_lerp
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
type Wr = Saturating<I16F16>;
assert_eq!(Wr::from_num(0.5).lerp(Wr::ZERO, Wr::MAX), Wr::MAX / 2);
assert_eq!(Wr::from_num(1.5).lerp(Wr::ZERO, Wr::MAX), Wr::MAX + Wr::MAX / 2);
sourcepub fn inv_lerp(self, start: Saturating<F>, end: Saturating<F>) -> Saturating<F>
pub fn inv_lerp(self, start: Saturating<F>, end: Saturating<F>) -> Saturating<F>
Inverse linear interpolation between start
and end
.
See also
FixedI32::saturating_inv_lerp
and
FixedU32::saturating_inv_lerp
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
type Wr = Saturating<I16F16>;
assert_eq!(
Wr::from_num(25).inv_lerp(Wr::from_num(20), Wr::from_num(40)),
Wr::from_num(0.25)
);
source§impl<F: FixedSigned> Saturating<F>
impl<F: FixedSigned> Saturating<F>
sourcepub fn signed_bits(self) -> u32
pub fn signed_bits(self) -> u32
Returns the number of bits required to represent the value.
The number of bits required includes an initial one for negative numbers, and an initial zero for non-negative numbers.
See also FixedI32::signed_bits
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I4F4, Saturating};
assert_eq!(Saturating(I4F4::from_num(-3)).signed_bits(), 7); // “_101.0000”
assert_eq!(Saturating(I4F4::from_num(-1)).signed_bits(), 5); // “___1.0000”
assert_eq!(Saturating(I4F4::from_num(-0.0625)).signed_bits(), 1); // “____.___1”
assert_eq!(Saturating(I4F4::from_num(0)).signed_bits(), 1); // “____.___0”
assert_eq!(Saturating(I4F4::from_num(0.0625)).signed_bits(), 2); // “____.__01”
assert_eq!(Saturating(I4F4::from_num(1)).signed_bits(), 6); // “__01.0000”
assert_eq!(Saturating(I4F4::from_num(3)).signed_bits(), 7); // “_011.0000”
sourcepub fn is_positive(self) -> bool
pub fn is_positive(self) -> bool
Returns true
if the number is > 0.
See also FixedI32::is_positive
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
assert!(Saturating(I16F16::from_num(4.3)).is_positive());
assert!(!Saturating(I16F16::ZERO).is_positive());
assert!(!Saturating(I16F16::from_num(-4.3)).is_positive());
sourcepub fn is_negative(self) -> bool
pub fn is_negative(self) -> bool
Returns true
if the number is < 0.
See also FixedI32::is_negative
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
assert!(!Saturating(I16F16::from_num(4.3)).is_negative());
assert!(!Saturating(I16F16::ZERO).is_negative());
assert!(Saturating(I16F16::from_num(-4.3)).is_negative());
sourcepub fn abs(self) -> Saturating<F>
pub fn abs(self) -> Saturating<F>
Saturating absolute value. Returns the absolute value, saturating on overflow.
Overflow can only occur when trying to find the absolute value of the minimum value.
See also FixedI32::saturating_abs
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::I16F16, Saturating};
assert_eq!(Saturating(I16F16::from_num(-5)).abs(), Saturating(I16F16::from_num(5)));
assert_eq!(Saturating(I16F16::MIN).abs(), Saturating(I16F16::MAX));
sourcepub fn signum(self) -> Saturating<F>
pub fn signum(self) -> Saturating<F>
Returns a number representing the sign of self
.
§Warning
Using this method when 1 and −1 cannot be represented is almost certainly a bug, however, this is allowed and gives the following saturated results.
- When there are no integer bits, for example for the type
Saturating<I0F16>
, the return value is zero whenself
is zero,MIN
whenself
is negative, andMAX
whenself
is positive. - When there is one integer bit, for example for the type
Saturating<I1F15>
, the return value is zero whenself
is zero, −1 whenself
is negative, andMAX
whenself
is positive.
See also
FixedI32::saturating_signum
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{
types::{I0F32, I1F31, I16F16},
Saturating,
};
assert_eq!(Saturating(<I16F16>::from_num(-3.9)).signum(), Saturating(I16F16::NEG_ONE));
assert_eq!(Saturating(<I16F16>::ZERO).signum(), Saturating(I16F16::ZERO));
assert_eq!(Saturating(<I16F16>::from_num(3.9)).signum(), Saturating(I16F16::ONE));
assert_eq!(Saturating(<I1F31>::from_num(0.5)).signum(), Saturating(I1F31::MAX));
assert_eq!(Saturating(<I0F32>::from_num(0.25)).signum(), Saturating(I0F32::MAX));
assert_eq!(Saturating(<I0F32>::from_num(-0.5)).signum(), Saturating(I0F32::MIN));
sourcepub fn add_unsigned(self, rhs: F::Unsigned) -> Saturating<F>
pub fn add_unsigned(self, rhs: F::Unsigned) -> Saturating<F>
Addition with an unsigned fixed-point number.
See also
FixedI32::saturating_add_unsigned
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{
types::{I16F16, U16F16},
Saturating,
};
assert_eq!(
Saturating::<I16F16>::from_num(-5).add_unsigned(U16F16::from_num(3)),
Saturating::<I16F16>::from_num(-2)
);
assert_eq!(
Saturating::<I16F16>::ZERO.add_unsigned(U16F16::MAX),
Saturating::<I16F16>::MAX
);
sourcepub fn sub_unsigned(self, rhs: F::Unsigned) -> Saturating<F>
pub fn sub_unsigned(self, rhs: F::Unsigned) -> Saturating<F>
Subtraction with an unsigned fixed-point number.
See also
FixedI32::saturating_sub_unsigned
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{
types::{I16F16, U16F16},
Saturating,
};
assert_eq!(
Saturating::<I16F16>::from_num(3).sub_unsigned(U16F16::from_num(5)),
Saturating::<I16F16>::from_num(-2)
);
assert_eq!(
Saturating::<I16F16>::ZERO.sub_unsigned(U16F16::MAX),
Saturating::<I16F16>::MIN
);
source§impl<F: FixedUnsigned> Saturating<F>
impl<F: FixedUnsigned> Saturating<F>
sourcepub fn significant_bits(self) -> u32
pub fn significant_bits(self) -> u32
Returns the number of bits required to represent the value.
See also
FixedU32::significant_bits
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::U4F4, Saturating};
assert_eq!(Saturating(U4F4::from_num(0)).significant_bits(), 0); // “____.____”
assert_eq!(Saturating(U4F4::from_num(0.0625)).significant_bits(), 1); // “____.___1”
assert_eq!(Saturating(U4F4::from_num(1)).significant_bits(), 5); // “___1.0000”
assert_eq!(Saturating(U4F4::from_num(3)).significant_bits(), 6); // “__11.0000”
sourcepub fn is_power_of_two(self) -> bool
pub fn is_power_of_two(self) -> bool
Returns true
if the fixed-point number is
2k for some integer k.
See also
FixedU32::is_power_of_two
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::U16F16, Saturating};
assert!(Saturating(U16F16::from_num(0.5)).is_power_of_two());
assert!(Saturating(U16F16::from_num(4)).is_power_of_two());
assert!(!Saturating(U16F16::from_num(5)).is_power_of_two());
sourcepub fn highest_one(self) -> Saturating<F>
pub fn highest_one(self) -> Saturating<F>
Returns the highest one in the binary representation, or zero
if self
is zero.
If self
> 0, the highest one is equal to the largest power
of two that is ≤ self
.
See also FixedU32::highest_one
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{types::U16F16, Saturating};
type T = Saturating<U16F16>;
assert_eq!(T::from_bits(0b11_0010).highest_one(), T::from_bits(0b10_0000));
assert_eq!(T::from_num(0.3).highest_one(), T::from_num(0.25));
assert_eq!(T::from_num(4).highest_one(), T::from_num(4));
assert_eq!(T::from_num(6.5).highest_one(), T::from_num(4));
assert_eq!(T::ZERO.highest_one(), T::ZERO);
sourcepub fn add_signed(self, rhs: F::Signed) -> Saturating<F>
pub fn add_signed(self, rhs: F::Signed) -> Saturating<F>
Addition with an signed fixed-point number.
See also
FixedU32::saturating_add_signed
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{
types::{I16F16, U16F16},
Saturating,
};
assert_eq!(
Saturating::<U16F16>::from_num(5).add_signed(I16F16::from_num(-3)),
Saturating::<U16F16>::from_num(2)
);
assert_eq!(
Saturating::<U16F16>::ZERO.add_signed(-I16F16::DELTA),
Saturating::<U16F16>::ZERO
);
sourcepub fn sub_signed(self, rhs: F::Signed) -> Saturating<F>
pub fn sub_signed(self, rhs: F::Signed) -> Saturating<F>
Subtraction with an signed fixed-point number.
See also
FixedU32::saturating_sub_signed
.
§Examples
#![feature(generic_const_exprs)]
use fixed::{
types::{I16F16, U16F16},
Saturating,
};
assert_eq!(
Saturating::<U16F16>::from_num(5).sub_signed(I16F16::from_num(-3)),
Saturating::<U16F16>::from_num(8)
);
assert_eq!(
Saturating::<U16F16>::ZERO.sub_signed(I16F16::DELTA),
Saturating::<U16F16>::ZERO
);
Trait Implementations§
source§impl<F: Fixed> Add<&Saturating<F>> for &Saturating<F>
impl<F: Fixed> Add<&Saturating<F>> for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
+
operator.source§fn add(self, other: &Saturating<F>) -> Saturating<F>
fn add(self, other: &Saturating<F>) -> Saturating<F>
+
operation. Read moresource§impl<F: Fixed> Add<&Saturating<F>> for Saturating<F>
impl<F: Fixed> Add<&Saturating<F>> for Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
+
operator.source§fn add(self, other: &Saturating<F>) -> Saturating<F>
fn add(self, other: &Saturating<F>) -> Saturating<F>
+
operation. Read moresource§impl<F: Fixed> Add<Saturating<F>> for &Saturating<F>
impl<F: Fixed> Add<Saturating<F>> for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
+
operator.source§fn add(self, other: Saturating<F>) -> Saturating<F>
fn add(self, other: Saturating<F>) -> Saturating<F>
+
operation. Read moresource§impl<F: Fixed> Add for Saturating<F>
impl<F: Fixed> Add for Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
+
operator.source§fn add(self, other: Saturating<F>) -> Saturating<F>
fn add(self, other: Saturating<F>) -> Saturating<F>
+
operation. Read moresource§impl<F: Fixed> AddAssign<&F> for Saturating<F>
impl<F: Fixed> AddAssign<&F> for Saturating<F>
source§fn add_assign(&mut self, other: &F)
fn add_assign(&mut self, other: &F)
+=
operation. Read moresource§impl<F: Fixed> AddAssign<&Saturating<F>> for Saturating<F>
impl<F: Fixed> AddAssign<&Saturating<F>> for Saturating<F>
source§fn add_assign(&mut self, other: &Saturating<F>)
fn add_assign(&mut self, other: &Saturating<F>)
+=
operation. Read moresource§impl<F: Fixed> AddAssign<F> for Saturating<F>
impl<F: Fixed> AddAssign<F> for Saturating<F>
source§fn add_assign(&mut self, other: F)
fn add_assign(&mut self, other: F)
+=
operation. Read moresource§impl<F: Fixed> AddAssign for Saturating<F>
impl<F: Fixed> AddAssign for Saturating<F>
source§fn add_assign(&mut self, other: Saturating<F>)
fn add_assign(&mut self, other: Saturating<F>)
+=
operation. Read moresource§impl<F: FixedBoundFrac> Binary for Saturating<F>
impl<F: FixedBoundFrac> Binary for Saturating<F>
source§impl<F> BitAnd<&Saturating<F>> for &Saturating<F>
impl<F> BitAnd<&Saturating<F>> for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
&
operator.source§fn bitand(self, other: &Saturating<F>) -> Saturating<F>
fn bitand(self, other: &Saturating<F>) -> Saturating<F>
&
operation. Read moresource§impl<F> BitAnd<&Saturating<F>> for Saturating<F>
impl<F> BitAnd<&Saturating<F>> for Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
&
operator.source§fn bitand(self, other: &Saturating<F>) -> Saturating<F>
fn bitand(self, other: &Saturating<F>) -> Saturating<F>
&
operation. Read moresource§impl<F> BitAnd<Saturating<F>> for &Saturating<F>
impl<F> BitAnd<Saturating<F>> for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
&
operator.source§fn bitand(self, other: Saturating<F>) -> Saturating<F>
fn bitand(self, other: Saturating<F>) -> Saturating<F>
&
operation. Read moresource§impl<F> BitAnd for Saturating<F>where
F: BitAnd<F, Output = F>,
impl<F> BitAnd for Saturating<F>where
F: BitAnd<F, Output = F>,
§type Output = Saturating<F>
type Output = Saturating<F>
&
operator.source§fn bitand(self, other: Saturating<F>) -> Saturating<F>
fn bitand(self, other: Saturating<F>) -> Saturating<F>
&
operation. Read moresource§impl<F> BitAndAssign<&F> for Saturating<F>where
for<'a> F: BitAndAssign<&'a F>,
impl<F> BitAndAssign<&F> for Saturating<F>where
for<'a> F: BitAndAssign<&'a F>,
source§fn bitand_assign(&mut self, other: &F)
fn bitand_assign(&mut self, other: &F)
&=
operation. Read moresource§impl<F> BitAndAssign<&Saturating<F>> for Saturating<F>where
for<'a> F: BitAndAssign<&'a F>,
impl<F> BitAndAssign<&Saturating<F>> for Saturating<F>where
for<'a> F: BitAndAssign<&'a F>,
source§fn bitand_assign(&mut self, other: &Saturating<F>)
fn bitand_assign(&mut self, other: &Saturating<F>)
&=
operation. Read moresource§impl<F> BitAndAssign<F> for Saturating<F>where
F: BitAndAssign<F>,
impl<F> BitAndAssign<F> for Saturating<F>where
F: BitAndAssign<F>,
source§fn bitand_assign(&mut self, other: F)
fn bitand_assign(&mut self, other: F)
&=
operation. Read moresource§impl<F> BitAndAssign for Saturating<F>where
F: BitAndAssign<F>,
impl<F> BitAndAssign for Saturating<F>where
F: BitAndAssign<F>,
source§fn bitand_assign(&mut self, other: Saturating<F>)
fn bitand_assign(&mut self, other: Saturating<F>)
&=
operation. Read moresource§impl<F> BitOr<&Saturating<F>> for &Saturating<F>
impl<F> BitOr<&Saturating<F>> for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
|
operator.source§fn bitor(self, other: &Saturating<F>) -> Saturating<F>
fn bitor(self, other: &Saturating<F>) -> Saturating<F>
|
operation. Read moresource§impl<F> BitOr<&Saturating<F>> for Saturating<F>
impl<F> BitOr<&Saturating<F>> for Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
|
operator.source§fn bitor(self, other: &Saturating<F>) -> Saturating<F>
fn bitor(self, other: &Saturating<F>) -> Saturating<F>
|
operation. Read moresource§impl<F> BitOr<Saturating<F>> for &Saturating<F>
impl<F> BitOr<Saturating<F>> for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
|
operator.source§fn bitor(self, other: Saturating<F>) -> Saturating<F>
fn bitor(self, other: Saturating<F>) -> Saturating<F>
|
operation. Read moresource§impl<F> BitOr for Saturating<F>where
F: BitOr<F, Output = F>,
impl<F> BitOr for Saturating<F>where
F: BitOr<F, Output = F>,
§type Output = Saturating<F>
type Output = Saturating<F>
|
operator.source§fn bitor(self, other: Saturating<F>) -> Saturating<F>
fn bitor(self, other: Saturating<F>) -> Saturating<F>
|
operation. Read moresource§impl<F> BitOrAssign<&F> for Saturating<F>where
for<'a> F: BitOrAssign<&'a F>,
impl<F> BitOrAssign<&F> for Saturating<F>where
for<'a> F: BitOrAssign<&'a F>,
source§fn bitor_assign(&mut self, other: &F)
fn bitor_assign(&mut self, other: &F)
|=
operation. Read moresource§impl<F> BitOrAssign<&Saturating<F>> for Saturating<F>where
for<'a> F: BitOrAssign<&'a F>,
impl<F> BitOrAssign<&Saturating<F>> for Saturating<F>where
for<'a> F: BitOrAssign<&'a F>,
source§fn bitor_assign(&mut self, other: &Saturating<F>)
fn bitor_assign(&mut self, other: &Saturating<F>)
|=
operation. Read moresource§impl<F> BitOrAssign<F> for Saturating<F>where
F: BitOrAssign<F>,
impl<F> BitOrAssign<F> for Saturating<F>where
F: BitOrAssign<F>,
source§fn bitor_assign(&mut self, other: F)
fn bitor_assign(&mut self, other: F)
|=
operation. Read moresource§impl<F> BitOrAssign for Saturating<F>where
F: BitOrAssign<F>,
impl<F> BitOrAssign for Saturating<F>where
F: BitOrAssign<F>,
source§fn bitor_assign(&mut self, other: Saturating<F>)
fn bitor_assign(&mut self, other: Saturating<F>)
|=
operation. Read moresource§impl<F> BitXor<&Saturating<F>> for &Saturating<F>
impl<F> BitXor<&Saturating<F>> for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
^
operator.source§fn bitxor(self, other: &Saturating<F>) -> Saturating<F>
fn bitxor(self, other: &Saturating<F>) -> Saturating<F>
^
operation. Read moresource§impl<F> BitXor<&Saturating<F>> for Saturating<F>
impl<F> BitXor<&Saturating<F>> for Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
^
operator.source§fn bitxor(self, other: &Saturating<F>) -> Saturating<F>
fn bitxor(self, other: &Saturating<F>) -> Saturating<F>
^
operation. Read moresource§impl<F> BitXor<Saturating<F>> for &Saturating<F>
impl<F> BitXor<Saturating<F>> for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
^
operator.source§fn bitxor(self, other: Saturating<F>) -> Saturating<F>
fn bitxor(self, other: Saturating<F>) -> Saturating<F>
^
operation. Read moresource§impl<F> BitXor for Saturating<F>where
F: BitXor<F, Output = F>,
impl<F> BitXor for Saturating<F>where
F: BitXor<F, Output = F>,
§type Output = Saturating<F>
type Output = Saturating<F>
^
operator.source§fn bitxor(self, other: Saturating<F>) -> Saturating<F>
fn bitxor(self, other: Saturating<F>) -> Saturating<F>
^
operation. Read moresource§impl<F> BitXorAssign<&F> for Saturating<F>where
for<'a> F: BitXorAssign<&'a F>,
impl<F> BitXorAssign<&F> for Saturating<F>where
for<'a> F: BitXorAssign<&'a F>,
source§fn bitxor_assign(&mut self, other: &F)
fn bitxor_assign(&mut self, other: &F)
^=
operation. Read moresource§impl<F> BitXorAssign<&Saturating<F>> for Saturating<F>where
for<'a> F: BitXorAssign<&'a F>,
impl<F> BitXorAssign<&Saturating<F>> for Saturating<F>where
for<'a> F: BitXorAssign<&'a F>,
source§fn bitxor_assign(&mut self, other: &Saturating<F>)
fn bitxor_assign(&mut self, other: &Saturating<F>)
^=
operation. Read moresource§impl<F> BitXorAssign<F> for Saturating<F>where
F: BitXorAssign<F>,
impl<F> BitXorAssign<F> for Saturating<F>where
F: BitXorAssign<F>,
source§fn bitxor_assign(&mut self, other: F)
fn bitxor_assign(&mut self, other: F)
^=
operation. Read moresource§impl<F> BitXorAssign for Saturating<F>where
F: BitXorAssign<F>,
impl<F> BitXorAssign for Saturating<F>where
F: BitXorAssign<F>,
source§fn bitxor_assign(&mut self, other: Saturating<F>)
fn bitxor_assign(&mut self, other: Saturating<F>)
^=
operation. Read moresource§impl<F: Clone> Clone for Saturating<F>
impl<F: Clone> Clone for Saturating<F>
source§fn clone(&self) -> Saturating<F>
fn clone(&self) -> Saturating<F>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<F: Fixed> Debug for Saturating<F>
impl<F: Fixed> Debug for Saturating<F>
source§impl<F: Default> Default for Saturating<F>
impl<F: Default> Default for Saturating<F>
source§fn default() -> Saturating<F>
fn default() -> Saturating<F>
source§impl<F: FixedBoundFrac> Display for Saturating<F>
impl<F: FixedBoundFrac> Display for Saturating<F>
source§impl<F: FixedBoundFrac> Div<&Saturating<F>> for &Saturating<F>
impl<F: FixedBoundFrac> Div<&Saturating<F>> for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
/
operator.source§fn div(self, other: &Saturating<F>) -> Saturating<F>
fn div(self, other: &Saturating<F>) -> Saturating<F>
/
operation. Read moresource§impl<F: FixedBoundFrac> Div<&Saturating<F>> for Saturating<F>
impl<F: FixedBoundFrac> Div<&Saturating<F>> for Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
/
operator.source§fn div(self, other: &Saturating<F>) -> Saturating<F>
fn div(self, other: &Saturating<F>) -> Saturating<F>
/
operation. Read moresource§impl<F: FixedBoundFrac> Div<Saturating<F>> for &Saturating<F>
impl<F: FixedBoundFrac> Div<Saturating<F>> for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
/
operator.source§fn div(self, other: Saturating<F>) -> Saturating<F>
fn div(self, other: Saturating<F>) -> Saturating<F>
/
operation. Read moresource§impl<F: FixedBoundFrac> Div for Saturating<F>
impl<F: FixedBoundFrac> Div for Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
/
operator.source§fn div(self, other: Saturating<F>) -> Saturating<F>
fn div(self, other: Saturating<F>) -> Saturating<F>
/
operation. Read moresource§impl<F: FixedBoundFrac> DivAssign<&F> for Saturating<F>
impl<F: FixedBoundFrac> DivAssign<&F> for Saturating<F>
source§fn div_assign(&mut self, other: &F)
fn div_assign(&mut self, other: &F)
/=
operation. Read moresource§impl<F: FixedBoundFrac> DivAssign<&Saturating<F>> for Saturating<F>
impl<F: FixedBoundFrac> DivAssign<&Saturating<F>> for Saturating<F>
source§fn div_assign(&mut self, other: &Saturating<F>)
fn div_assign(&mut self, other: &Saturating<F>)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<&i128> for Saturating<FixedI128<FRAC>>
impl<const FRAC: i32> DivAssign<&i128> for Saturating<FixedI128<FRAC>>
source§fn div_assign(&mut self, other: &i128)
fn div_assign(&mut self, other: &i128)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<&i16> for Saturating<FixedI16<FRAC>>
impl<const FRAC: i32> DivAssign<&i16> for Saturating<FixedI16<FRAC>>
source§fn div_assign(&mut self, other: &i16)
fn div_assign(&mut self, other: &i16)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<&i32> for Saturating<FixedI32<FRAC>>
impl<const FRAC: i32> DivAssign<&i32> for Saturating<FixedI32<FRAC>>
source§fn div_assign(&mut self, other: &i32)
fn div_assign(&mut self, other: &i32)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<&i64> for Saturating<FixedI64<FRAC>>
impl<const FRAC: i32> DivAssign<&i64> for Saturating<FixedI64<FRAC>>
source§fn div_assign(&mut self, other: &i64)
fn div_assign(&mut self, other: &i64)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<&i8> for Saturating<FixedI8<FRAC>>
impl<const FRAC: i32> DivAssign<&i8> for Saturating<FixedI8<FRAC>>
source§fn div_assign(&mut self, other: &i8)
fn div_assign(&mut self, other: &i8)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<&u128> for Saturating<FixedU128<FRAC>>
impl<const FRAC: i32> DivAssign<&u128> for Saturating<FixedU128<FRAC>>
source§fn div_assign(&mut self, other: &u128)
fn div_assign(&mut self, other: &u128)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<&u16> for Saturating<FixedU16<FRAC>>
impl<const FRAC: i32> DivAssign<&u16> for Saturating<FixedU16<FRAC>>
source§fn div_assign(&mut self, other: &u16)
fn div_assign(&mut self, other: &u16)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<&u32> for Saturating<FixedU32<FRAC>>
impl<const FRAC: i32> DivAssign<&u32> for Saturating<FixedU32<FRAC>>
source§fn div_assign(&mut self, other: &u32)
fn div_assign(&mut self, other: &u32)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<&u64> for Saturating<FixedU64<FRAC>>
impl<const FRAC: i32> DivAssign<&u64> for Saturating<FixedU64<FRAC>>
source§fn div_assign(&mut self, other: &u64)
fn div_assign(&mut self, other: &u64)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<&u8> for Saturating<FixedU8<FRAC>>
impl<const FRAC: i32> DivAssign<&u8> for Saturating<FixedU8<FRAC>>
source§fn div_assign(&mut self, other: &u8)
fn div_assign(&mut self, other: &u8)
/=
operation. Read moresource§impl<F: FixedBoundFrac> DivAssign<F> for Saturating<F>
impl<F: FixedBoundFrac> DivAssign<F> for Saturating<F>
source§fn div_assign(&mut self, other: F)
fn div_assign(&mut self, other: F)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<i128> for Saturating<FixedI128<FRAC>>
impl<const FRAC: i32> DivAssign<i128> for Saturating<FixedI128<FRAC>>
source§fn div_assign(&mut self, other: i128)
fn div_assign(&mut self, other: i128)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<i16> for Saturating<FixedI16<FRAC>>
impl<const FRAC: i32> DivAssign<i16> for Saturating<FixedI16<FRAC>>
source§fn div_assign(&mut self, other: i16)
fn div_assign(&mut self, other: i16)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<i32> for Saturating<FixedI32<FRAC>>
impl<const FRAC: i32> DivAssign<i32> for Saturating<FixedI32<FRAC>>
source§fn div_assign(&mut self, other: i32)
fn div_assign(&mut self, other: i32)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<i64> for Saturating<FixedI64<FRAC>>
impl<const FRAC: i32> DivAssign<i64> for Saturating<FixedI64<FRAC>>
source§fn div_assign(&mut self, other: i64)
fn div_assign(&mut self, other: i64)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<i8> for Saturating<FixedI8<FRAC>>
impl<const FRAC: i32> DivAssign<i8> for Saturating<FixedI8<FRAC>>
source§fn div_assign(&mut self, other: i8)
fn div_assign(&mut self, other: i8)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<u128> for Saturating<FixedU128<FRAC>>
impl<const FRAC: i32> DivAssign<u128> for Saturating<FixedU128<FRAC>>
source§fn div_assign(&mut self, other: u128)
fn div_assign(&mut self, other: u128)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<u16> for Saturating<FixedU16<FRAC>>
impl<const FRAC: i32> DivAssign<u16> for Saturating<FixedU16<FRAC>>
source§fn div_assign(&mut self, other: u16)
fn div_assign(&mut self, other: u16)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<u32> for Saturating<FixedU32<FRAC>>
impl<const FRAC: i32> DivAssign<u32> for Saturating<FixedU32<FRAC>>
source§fn div_assign(&mut self, other: u32)
fn div_assign(&mut self, other: u32)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<u64> for Saturating<FixedU64<FRAC>>
impl<const FRAC: i32> DivAssign<u64> for Saturating<FixedU64<FRAC>>
source§fn div_assign(&mut self, other: u64)
fn div_assign(&mut self, other: u64)
/=
operation. Read moresource§impl<const FRAC: i32> DivAssign<u8> for Saturating<FixedU8<FRAC>>
impl<const FRAC: i32> DivAssign<u8> for Saturating<FixedU8<FRAC>>
source§fn div_assign(&mut self, other: u8)
fn div_assign(&mut self, other: u8)
/=
operation. Read moresource§impl<F: FixedBoundFrac> DivAssign for Saturating<F>
impl<F: FixedBoundFrac> DivAssign for Saturating<F>
source§fn div_assign(&mut self, other: Saturating<F>)
fn div_assign(&mut self, other: Saturating<F>)
/=
operation. Read moresource§impl<F: Fixed> From<F> for Saturating<F>
impl<F: Fixed> From<F> for Saturating<F>
source§fn from(src: F) -> Saturating<F>
fn from(src: F) -> Saturating<F>
Saturates a fixed-point number.
source§impl<F: FixedBoundFrac> FromStr for Saturating<F>
impl<F: FixedBoundFrac> FromStr for Saturating<F>
source§impl<F: Hash> Hash for Saturating<F>
impl<F: Hash> Hash for Saturating<F>
source§impl<F: FixedBoundFrac> LowerExp for Saturating<F>
impl<F: FixedBoundFrac> LowerExp for Saturating<F>
source§impl<F: FixedBoundFrac> LowerHex for Saturating<F>
impl<F: FixedBoundFrac> LowerHex for Saturating<F>
source§impl<F: Fixed> Mul<&Saturating<F>> for &Saturating<F>
impl<F: Fixed> Mul<&Saturating<F>> for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
*
operator.source§fn mul(self, other: &Saturating<F>) -> Saturating<F>
fn mul(self, other: &Saturating<F>) -> Saturating<F>
*
operation. Read moresource§impl<F: Fixed> Mul<&Saturating<F>> for Saturating<F>
impl<F: Fixed> Mul<&Saturating<F>> for Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
*
operator.source§fn mul(self, other: &Saturating<F>) -> Saturating<F>
fn mul(self, other: &Saturating<F>) -> Saturating<F>
*
operation. Read moresource§impl<F: Fixed> Mul<Saturating<F>> for &Saturating<F>
impl<F: Fixed> Mul<Saturating<F>> for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
*
operator.source§fn mul(self, other: Saturating<F>) -> Saturating<F>
fn mul(self, other: Saturating<F>) -> Saturating<F>
*
operation. Read moresource§impl<F: Fixed> Mul for Saturating<F>
impl<F: Fixed> Mul for Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
*
operator.source§fn mul(self, other: Saturating<F>) -> Saturating<F>
fn mul(self, other: Saturating<F>) -> Saturating<F>
*
operation. Read moresource§impl<F: Fixed> MulAssign<&F> for Saturating<F>
impl<F: Fixed> MulAssign<&F> for Saturating<F>
source§fn mul_assign(&mut self, other: &F)
fn mul_assign(&mut self, other: &F)
*=
operation. Read moresource§impl<F: Fixed> MulAssign<&Saturating<F>> for Saturating<F>
impl<F: Fixed> MulAssign<&Saturating<F>> for Saturating<F>
source§fn mul_assign(&mut self, other: &Saturating<F>)
fn mul_assign(&mut self, other: &Saturating<F>)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<&i128> for Saturating<FixedI128<FRAC>>
impl<const FRAC: i32> MulAssign<&i128> for Saturating<FixedI128<FRAC>>
source§fn mul_assign(&mut self, other: &i128)
fn mul_assign(&mut self, other: &i128)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<&i16> for Saturating<FixedI16<FRAC>>
impl<const FRAC: i32> MulAssign<&i16> for Saturating<FixedI16<FRAC>>
source§fn mul_assign(&mut self, other: &i16)
fn mul_assign(&mut self, other: &i16)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<&i32> for Saturating<FixedI32<FRAC>>
impl<const FRAC: i32> MulAssign<&i32> for Saturating<FixedI32<FRAC>>
source§fn mul_assign(&mut self, other: &i32)
fn mul_assign(&mut self, other: &i32)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<&i64> for Saturating<FixedI64<FRAC>>
impl<const FRAC: i32> MulAssign<&i64> for Saturating<FixedI64<FRAC>>
source§fn mul_assign(&mut self, other: &i64)
fn mul_assign(&mut self, other: &i64)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<&i8> for Saturating<FixedI8<FRAC>>
impl<const FRAC: i32> MulAssign<&i8> for Saturating<FixedI8<FRAC>>
source§fn mul_assign(&mut self, other: &i8)
fn mul_assign(&mut self, other: &i8)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<&u128> for Saturating<FixedU128<FRAC>>
impl<const FRAC: i32> MulAssign<&u128> for Saturating<FixedU128<FRAC>>
source§fn mul_assign(&mut self, other: &u128)
fn mul_assign(&mut self, other: &u128)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<&u16> for Saturating<FixedU16<FRAC>>
impl<const FRAC: i32> MulAssign<&u16> for Saturating<FixedU16<FRAC>>
source§fn mul_assign(&mut self, other: &u16)
fn mul_assign(&mut self, other: &u16)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<&u32> for Saturating<FixedU32<FRAC>>
impl<const FRAC: i32> MulAssign<&u32> for Saturating<FixedU32<FRAC>>
source§fn mul_assign(&mut self, other: &u32)
fn mul_assign(&mut self, other: &u32)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<&u64> for Saturating<FixedU64<FRAC>>
impl<const FRAC: i32> MulAssign<&u64> for Saturating<FixedU64<FRAC>>
source§fn mul_assign(&mut self, other: &u64)
fn mul_assign(&mut self, other: &u64)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<&u8> for Saturating<FixedU8<FRAC>>
impl<const FRAC: i32> MulAssign<&u8> for Saturating<FixedU8<FRAC>>
source§fn mul_assign(&mut self, other: &u8)
fn mul_assign(&mut self, other: &u8)
*=
operation. Read moresource§impl<F: Fixed> MulAssign<F> for Saturating<F>
impl<F: Fixed> MulAssign<F> for Saturating<F>
source§fn mul_assign(&mut self, other: F)
fn mul_assign(&mut self, other: F)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<i128> for Saturating<FixedI128<FRAC>>
impl<const FRAC: i32> MulAssign<i128> for Saturating<FixedI128<FRAC>>
source§fn mul_assign(&mut self, other: i128)
fn mul_assign(&mut self, other: i128)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<i16> for Saturating<FixedI16<FRAC>>
impl<const FRAC: i32> MulAssign<i16> for Saturating<FixedI16<FRAC>>
source§fn mul_assign(&mut self, other: i16)
fn mul_assign(&mut self, other: i16)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<i32> for Saturating<FixedI32<FRAC>>
impl<const FRAC: i32> MulAssign<i32> for Saturating<FixedI32<FRAC>>
source§fn mul_assign(&mut self, other: i32)
fn mul_assign(&mut self, other: i32)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<i64> for Saturating<FixedI64<FRAC>>
impl<const FRAC: i32> MulAssign<i64> for Saturating<FixedI64<FRAC>>
source§fn mul_assign(&mut self, other: i64)
fn mul_assign(&mut self, other: i64)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<i8> for Saturating<FixedI8<FRAC>>
impl<const FRAC: i32> MulAssign<i8> for Saturating<FixedI8<FRAC>>
source§fn mul_assign(&mut self, other: i8)
fn mul_assign(&mut self, other: i8)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<u128> for Saturating<FixedU128<FRAC>>
impl<const FRAC: i32> MulAssign<u128> for Saturating<FixedU128<FRAC>>
source§fn mul_assign(&mut self, other: u128)
fn mul_assign(&mut self, other: u128)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<u16> for Saturating<FixedU16<FRAC>>
impl<const FRAC: i32> MulAssign<u16> for Saturating<FixedU16<FRAC>>
source§fn mul_assign(&mut self, other: u16)
fn mul_assign(&mut self, other: u16)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<u32> for Saturating<FixedU32<FRAC>>
impl<const FRAC: i32> MulAssign<u32> for Saturating<FixedU32<FRAC>>
source§fn mul_assign(&mut self, other: u32)
fn mul_assign(&mut self, other: u32)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<u64> for Saturating<FixedU64<FRAC>>
impl<const FRAC: i32> MulAssign<u64> for Saturating<FixedU64<FRAC>>
source§fn mul_assign(&mut self, other: u64)
fn mul_assign(&mut self, other: u64)
*=
operation. Read moresource§impl<const FRAC: i32> MulAssign<u8> for Saturating<FixedU8<FRAC>>
impl<const FRAC: i32> MulAssign<u8> for Saturating<FixedU8<FRAC>>
source§fn mul_assign(&mut self, other: u8)
fn mul_assign(&mut self, other: u8)
*=
operation. Read moresource§impl<F: Fixed> MulAssign for Saturating<F>
impl<F: Fixed> MulAssign for Saturating<F>
source§fn mul_assign(&mut self, other: Saturating<F>)
fn mul_assign(&mut self, other: Saturating<F>)
*=
operation. Read moresource§impl<F: Fixed> Neg for &Saturating<F>
impl<F: Fixed> Neg for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
-
operator.source§fn neg(self) -> Saturating<F>
fn neg(self) -> Saturating<F>
-
operation. Read moresource§impl<F: Fixed> Neg for Saturating<F>
impl<F: Fixed> Neg for Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
-
operator.source§fn neg(self) -> Saturating<F>
fn neg(self) -> Saturating<F>
-
operation. Read moresource§impl<F> Not for &Saturating<F>
impl<F> Not for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
!
operator.source§fn not(self) -> Saturating<F>
fn not(self) -> Saturating<F>
!
operation. Read moresource§impl<F> Not for Saturating<F>where
F: Not<Output = F>,
impl<F> Not for Saturating<F>where
F: Not<Output = F>,
§type Output = Saturating<F>
type Output = Saturating<F>
!
operator.source§fn not(self) -> Saturating<F>
fn not(self) -> Saturating<F>
!
operation. Read moresource§impl<F: FixedBoundFrac> Octal for Saturating<F>
impl<F: FixedBoundFrac> Octal for Saturating<F>
source§impl<F: Ord> Ord for Saturating<F>
impl<F: Ord> Ord for Saturating<F>
source§fn cmp(&self, other: &Saturating<F>) -> Ordering
fn cmp(&self, other: &Saturating<F>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<F: PartialEq> PartialEq for Saturating<F>
impl<F: PartialEq> PartialEq for Saturating<F>
source§fn eq(&self, other: &Saturating<F>) -> bool
fn eq(&self, other: &Saturating<F>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<F: PartialOrd> PartialOrd for Saturating<F>
impl<F: PartialOrd> PartialOrd for Saturating<F>
source§fn partial_cmp(&self, other: &Saturating<F>) -> Option<Ordering>
fn partial_cmp(&self, other: &Saturating<F>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<'a, F: 'a + Fixed> Product<&'a Saturating<F>> for Saturating<F>
impl<'a, F: 'a + Fixed> Product<&'a Saturating<F>> for Saturating<F>
source§fn product<I>(iter: I) -> Saturating<F>where
I: Iterator<Item = &'a Saturating<F>>,
fn product<I>(iter: I) -> Saturating<F>where
I: Iterator<Item = &'a Saturating<F>>,
Self
from the elements by
multiplying the items.source§impl<F: Fixed> Product for Saturating<F>
impl<F: Fixed> Product for Saturating<F>
source§fn product<I>(iter: I) -> Saturating<F>where
I: Iterator<Item = Saturating<F>>,
fn product<I>(iter: I) -> Saturating<F>where
I: Iterator<Item = Saturating<F>>,
Self
from the elements by
multiplying the items.source§impl<F: Fixed> Rem<&Saturating<F>> for &Saturating<F>
impl<F: Fixed> Rem<&Saturating<F>> for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
%
operator.source§fn rem(self, other: &Saturating<F>) -> Saturating<F>
fn rem(self, other: &Saturating<F>) -> Saturating<F>
%
operation. Read moresource§impl<F: Fixed> Rem<&Saturating<F>> for Saturating<F>
impl<F: Fixed> Rem<&Saturating<F>> for Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
%
operator.source§fn rem(self, other: &Saturating<F>) -> Saturating<F>
fn rem(self, other: &Saturating<F>) -> Saturating<F>
%
operation. Read moresource§impl<F: Fixed> Rem<Saturating<F>> for &Saturating<F>
impl<F: Fixed> Rem<Saturating<F>> for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
%
operator.source§fn rem(self, other: Saturating<F>) -> Saturating<F>
fn rem(self, other: Saturating<F>) -> Saturating<F>
%
operation. Read moresource§impl<F: Fixed> Rem for Saturating<F>
impl<F: Fixed> Rem for Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
%
operator.source§fn rem(self, other: Saturating<F>) -> Saturating<F>
fn rem(self, other: Saturating<F>) -> Saturating<F>
%
operation. Read moresource§impl<F: Fixed> RemAssign<&F> for Saturating<F>
impl<F: Fixed> RemAssign<&F> for Saturating<F>
source§fn rem_assign(&mut self, other: &F)
fn rem_assign(&mut self, other: &F)
%=
operation. Read moresource§impl<F: Fixed> RemAssign<&Saturating<F>> for Saturating<F>
impl<F: Fixed> RemAssign<&Saturating<F>> for Saturating<F>
source§fn rem_assign(&mut self, other: &Saturating<F>)
fn rem_assign(&mut self, other: &Saturating<F>)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<&i128> for Saturating<FixedI128<FRAC>>
impl<const FRAC: i32> RemAssign<&i128> for Saturating<FixedI128<FRAC>>
source§fn rem_assign(&mut self, other: &i128)
fn rem_assign(&mut self, other: &i128)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<&i16> for Saturating<FixedI16<FRAC>>
impl<const FRAC: i32> RemAssign<&i16> for Saturating<FixedI16<FRAC>>
source§fn rem_assign(&mut self, other: &i16)
fn rem_assign(&mut self, other: &i16)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<&i32> for Saturating<FixedI32<FRAC>>
impl<const FRAC: i32> RemAssign<&i32> for Saturating<FixedI32<FRAC>>
source§fn rem_assign(&mut self, other: &i32)
fn rem_assign(&mut self, other: &i32)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<&i64> for Saturating<FixedI64<FRAC>>
impl<const FRAC: i32> RemAssign<&i64> for Saturating<FixedI64<FRAC>>
source§fn rem_assign(&mut self, other: &i64)
fn rem_assign(&mut self, other: &i64)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<&i8> for Saturating<FixedI8<FRAC>>
impl<const FRAC: i32> RemAssign<&i8> for Saturating<FixedI8<FRAC>>
source§fn rem_assign(&mut self, other: &i8)
fn rem_assign(&mut self, other: &i8)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<&u128> for Saturating<FixedU128<FRAC>>
impl<const FRAC: i32> RemAssign<&u128> for Saturating<FixedU128<FRAC>>
source§fn rem_assign(&mut self, other: &u128)
fn rem_assign(&mut self, other: &u128)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<&u16> for Saturating<FixedU16<FRAC>>
impl<const FRAC: i32> RemAssign<&u16> for Saturating<FixedU16<FRAC>>
source§fn rem_assign(&mut self, other: &u16)
fn rem_assign(&mut self, other: &u16)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<&u32> for Saturating<FixedU32<FRAC>>
impl<const FRAC: i32> RemAssign<&u32> for Saturating<FixedU32<FRAC>>
source§fn rem_assign(&mut self, other: &u32)
fn rem_assign(&mut self, other: &u32)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<&u64> for Saturating<FixedU64<FRAC>>
impl<const FRAC: i32> RemAssign<&u64> for Saturating<FixedU64<FRAC>>
source§fn rem_assign(&mut self, other: &u64)
fn rem_assign(&mut self, other: &u64)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<&u8> for Saturating<FixedU8<FRAC>>
impl<const FRAC: i32> RemAssign<&u8> for Saturating<FixedU8<FRAC>>
source§fn rem_assign(&mut self, other: &u8)
fn rem_assign(&mut self, other: &u8)
%=
operation. Read moresource§impl<F: Fixed> RemAssign<F> for Saturating<F>
impl<F: Fixed> RemAssign<F> for Saturating<F>
source§fn rem_assign(&mut self, other: F)
fn rem_assign(&mut self, other: F)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<i128> for Saturating<FixedI128<FRAC>>
impl<const FRAC: i32> RemAssign<i128> for Saturating<FixedI128<FRAC>>
source§fn rem_assign(&mut self, other: i128)
fn rem_assign(&mut self, other: i128)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<i16> for Saturating<FixedI16<FRAC>>
impl<const FRAC: i32> RemAssign<i16> for Saturating<FixedI16<FRAC>>
source§fn rem_assign(&mut self, other: i16)
fn rem_assign(&mut self, other: i16)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<i32> for Saturating<FixedI32<FRAC>>
impl<const FRAC: i32> RemAssign<i32> for Saturating<FixedI32<FRAC>>
source§fn rem_assign(&mut self, other: i32)
fn rem_assign(&mut self, other: i32)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<i64> for Saturating<FixedI64<FRAC>>
impl<const FRAC: i32> RemAssign<i64> for Saturating<FixedI64<FRAC>>
source§fn rem_assign(&mut self, other: i64)
fn rem_assign(&mut self, other: i64)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<i8> for Saturating<FixedI8<FRAC>>
impl<const FRAC: i32> RemAssign<i8> for Saturating<FixedI8<FRAC>>
source§fn rem_assign(&mut self, other: i8)
fn rem_assign(&mut self, other: i8)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<u128> for Saturating<FixedU128<FRAC>>
impl<const FRAC: i32> RemAssign<u128> for Saturating<FixedU128<FRAC>>
source§fn rem_assign(&mut self, other: u128)
fn rem_assign(&mut self, other: u128)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<u16> for Saturating<FixedU16<FRAC>>
impl<const FRAC: i32> RemAssign<u16> for Saturating<FixedU16<FRAC>>
source§fn rem_assign(&mut self, other: u16)
fn rem_assign(&mut self, other: u16)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<u32> for Saturating<FixedU32<FRAC>>
impl<const FRAC: i32> RemAssign<u32> for Saturating<FixedU32<FRAC>>
source§fn rem_assign(&mut self, other: u32)
fn rem_assign(&mut self, other: u32)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<u64> for Saturating<FixedU64<FRAC>>
impl<const FRAC: i32> RemAssign<u64> for Saturating<FixedU64<FRAC>>
source§fn rem_assign(&mut self, other: u64)
fn rem_assign(&mut self, other: u64)
%=
operation. Read moresource§impl<const FRAC: i32> RemAssign<u8> for Saturating<FixedU8<FRAC>>
impl<const FRAC: i32> RemAssign<u8> for Saturating<FixedU8<FRAC>>
source§fn rem_assign(&mut self, other: u8)
fn rem_assign(&mut self, other: u8)
%=
operation. Read moresource§impl<F: Fixed> RemAssign for Saturating<F>
impl<F: Fixed> RemAssign for Saturating<F>
source§fn rem_assign(&mut self, other: Saturating<F>)
fn rem_assign(&mut self, other: Saturating<F>)
%=
operation. Read moresource§impl<F: Fixed> Sub<&Saturating<F>> for &Saturating<F>
impl<F: Fixed> Sub<&Saturating<F>> for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
-
operator.source§fn sub(self, other: &Saturating<F>) -> Saturating<F>
fn sub(self, other: &Saturating<F>) -> Saturating<F>
-
operation. Read moresource§impl<F: Fixed> Sub<&Saturating<F>> for Saturating<F>
impl<F: Fixed> Sub<&Saturating<F>> for Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
-
operator.source§fn sub(self, other: &Saturating<F>) -> Saturating<F>
fn sub(self, other: &Saturating<F>) -> Saturating<F>
-
operation. Read moresource§impl<F: Fixed> Sub<Saturating<F>> for &Saturating<F>
impl<F: Fixed> Sub<Saturating<F>> for &Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
-
operator.source§fn sub(self, other: Saturating<F>) -> Saturating<F>
fn sub(self, other: Saturating<F>) -> Saturating<F>
-
operation. Read moresource§impl<F: Fixed> Sub for Saturating<F>
impl<F: Fixed> Sub for Saturating<F>
§type Output = Saturating<F>
type Output = Saturating<F>
-
operator.source§fn sub(self, other: Saturating<F>) -> Saturating<F>
fn sub(self, other: Saturating<F>) -> Saturating<F>
-
operation. Read moresource§impl<F: Fixed> SubAssign<&F> for Saturating<F>
impl<F: Fixed> SubAssign<&F> for Saturating<F>
source§fn sub_assign(&mut self, other: &F)
fn sub_assign(&mut self, other: &F)
-=
operation. Read moresource§impl<F: Fixed> SubAssign<&Saturating<F>> for Saturating<F>
impl<F: Fixed> SubAssign<&Saturating<F>> for Saturating<F>
source§fn sub_assign(&mut self, other: &Saturating<F>)
fn sub_assign(&mut self, other: &Saturating<F>)
-=
operation. Read moresource§impl<F: Fixed> SubAssign<F> for Saturating<F>
impl<F: Fixed> SubAssign<F> for Saturating<F>
source§fn sub_assign(&mut self, other: F)
fn sub_assign(&mut self, other: F)
-=
operation. Read moresource§impl<F: Fixed> SubAssign for Saturating<F>
impl<F: Fixed> SubAssign for Saturating<F>
source§fn sub_assign(&mut self, other: Saturating<F>)
fn sub_assign(&mut self, other: Saturating<F>)
-=
operation. Read moresource§impl<'a, F: 'a + Fixed> Sum<&'a Saturating<F>> for Saturating<F>
impl<'a, F: 'a + Fixed> Sum<&'a Saturating<F>> for Saturating<F>
source§fn sum<I>(iter: I) -> Saturating<F>where
I: Iterator<Item = &'a Saturating<F>>,
fn sum<I>(iter: I) -> Saturating<F>where
I: Iterator<Item = &'a Saturating<F>>,
Self
from the elements by
“summing up” the items.source§impl<F: Fixed> Sum for Saturating<F>
impl<F: Fixed> Sum for Saturating<F>
source§fn sum<I>(iter: I) -> Saturating<F>where
I: Iterator<Item = Saturating<F>>,
fn sum<I>(iter: I) -> Saturating<F>where
I: Iterator<Item = Saturating<F>>,
Self
from the elements by
“summing up” the items.