#[repr(transparent)]
pub struct Wrapping<F>(pub F);
Expand description

Provides intentionally wrapped arithmetic on fixed-point numbers.

The underlying value can be retrieved through the .0 index.

Examples

#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
let max = Wrapping(I16F16::MAX);
let delta = Wrapping(I16F16::DELTA);
assert_eq!(I16F16::MIN, (max + delta).0);

Tuple Fields

0: F

Implementations

Zero.

See also FixedI32::ZERO and FixedU32::ZERO.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
assert_eq!(Wrapping::<I16F16>::ZERO, Wrapping(I16F16::ZERO));

The difference between any two successive representable numbers, Δ.

See also FixedI32::DELTA and FixedU32::DELTA.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
assert_eq!(Wrapping::<I16F16>::DELTA, Wrapping(I16F16::DELTA));

The smallest value that can be represented.

See also FixedI32::MIN and FixedU32::MIN.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
assert_eq!(Wrapping::<I16F16>::MIN, Wrapping(I16F16::MIN));

The largest value that can be represented.

See also FixedI32::MAX and FixedU32::MAX.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
assert_eq!(Wrapping::<I16F16>::MAX, Wrapping(I16F16::MAX));

true if the type is signed.

See also FixedI32::IS_SIGNED and FixedU32::IS_SIGNED.

Examples
#![feature(generic_const_exprs)]

use fixed::{
    types::{I16F16, U16F16},
    Wrapping,
};
assert!(Wrapping::<I16F16>::IS_SIGNED);
assert!(!Wrapping::<U16F16>::IS_SIGNED);

The number of integer bits.

See also FixedI32::INT_BITS and FixedU32::INT_BITS.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
assert_eq!(Wrapping::<I16F16>::INT_BITS, I16F16::INT_BITS);

The number of fractional bits.

See also FixedI32::FRAC_BITS and FixedU32::FRAC_BITS.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
assert_eq!(Wrapping::<I16F16>::FRAC_BITS, I16F16::FRAC_BITS);

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, Wrapping};
assert_eq!(Wrapping::<I16F16>::from_bits(0x1C), Wrapping(I16F16::from_bits(0x1C)));

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, Wrapping};
let w = Wrapping(I16F16::from_bits(0x1C));
assert_eq!(w.to_bits(), 0x1C);

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, Wrapping};
let w = Wrapping(I16F16::from_bits(0x1234_5678));
if cfg!(target_endian = "big") {
    assert_eq!(Wrapping::from_be(w), w);
} else {
    assert_eq!(Wrapping::from_be(w), w.swap_bytes());
}

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, Wrapping};
let w = Wrapping(I16F16::from_bits(0x1234_5678));
if cfg!(target_endian = "little") {
    assert_eq!(Wrapping::from_le(w), w);
} else {
    assert_eq!(Wrapping::from_le(w), w.swap_bytes());
}

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, Wrapping};
let w = Wrapping(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());
}

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, Wrapping};
let w = Wrapping(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());
}

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, Wrapping};
let w = Wrapping(I16F16::from_bits(0x1234_5678));
let swapped = Wrapping(I16F16::from_bits(0x7856_3412));
assert_eq!(w.swap_bytes(), swapped);

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, Wrapping};
let bytes = [0x12, 0x34, 0x56, 0x78];
assert_eq!(
    Wrapping::<I16F16>::from_be_bytes(bytes),
    Wrapping::<I16F16>::from_bits(0x1234_5678)
);

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, Wrapping};
let bytes = [0x78, 0x56, 0x34, 0x12];
assert_eq!(
    Wrapping::<I16F16>::from_le_bytes(bytes),
    Wrapping::<I16F16>::from_bits(0x1234_5678)
);

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, Wrapping};
let bytes = if cfg!(target_endian = "big") {
    [0x12, 0x34, 0x56, 0x78]
} else {
    [0x78, 0x56, 0x34, 0x12]
};
assert_eq!(
    Wrapping::<I16F16>::from_ne_bytes(bytes),
    Wrapping::<I16F16>::from_bits(0x1234_5678)
);

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, Wrapping};
assert_eq!(
    Wrapping::<I16F16>::from_bits(0x1234_5678).to_be_bytes(),
    [0x12, 0x34, 0x56, 0x78]
);

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, Wrapping};
assert_eq!(
    Wrapping::<I16F16>::from_bits(0x1234_5678).to_le_bytes(),
    [0x78, 0x56, 0x34, 0x12]
);

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, Wrapping};
let bytes = if cfg!(target_endian = "big") {
    [0x12, 0x34, 0x56, 0x78]
} else {
    [0x78, 0x56, 0x34, 0x12]
};
assert_eq!(
    Wrapping::<I16F16>::from_bits(0x1234_5678).to_ne_bytes(),
    bytes
);

Wrapping 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, or usize.
  • A floating-point number of type f16, bf16, f32, f64 or F128. For this conversion, the method rounds to the nearest, with ties rounding to even.
  • Any other number src for which ToFixed is implemented, in which case this method returns Wrapping(src.wrapping_to_fixed()).

See also FixedI32::wrapping_from_num and FixedU32::wrapping_from_num.

Panics

For floating-point numbers, panics if the value is not finite.

Examples
#![feature(generic_const_exprs)]

use fixed::{
    types::{I4F4, I16F16},
    Wrapping,
};

// 0x1234.5678 wraps into 0x4.5
let src = I16F16::from_bits(0x1234_5678);
let dst = Wrapping::<I4F4>::from_num(src);
assert_eq!(dst, Wrapping(I4F4::from_bits(0x45)));

// 0x1234 wraps into 0x4.0
let src_int = 0x1234_i32;
let dst_int = Wrapping::<I4F4>::from_num(src_int);
assert_eq!(dst_int, Wrapping(I4F4::from_bits(0x40)));

// 129.75 wrapped into 1.75 (binary 1.1100)
let src_float = 129.75;
let dst_float = Wrapping::<I4F4>::from_num(src_float);
assert_eq!(dst_float, Wrapping(I4F4::from_bits(0b11100)));

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 discarded, which rounds towards −∞.
  • An integer of type i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, or usize. Any fractional bits are discarded, which rounds towards −∞.
  • A floating-point number of type f16, bf16, f32, f64 or F128. For this conversion, the method rounds to the nearest, with ties rounding to even.
  • Any other type Dst for which FromFixed is implemented, in which case this method returns Dst::wrapping_from_fixed(self.0).

See also FixedI32::wrapping_to_num and FixedU32::wrapping_to_num.

Examples
#![feature(generic_const_exprs)]

use fixed::{
    types::{I16F16, I2F6, I4F4},
    Wrapping,
};

// conversion that fits
let src = Wrapping(I4F4::from_num(1.75));
let expected = I16F16::from_num(1.75);
assert_eq!(src.to_num::<I16F16>(), expected);

// conversion that wraps
let src = Wrapping(I4F4::MAX);
let wrapped = I2F6::from_bits(I2F6::MAX.to_bits() << 2);
assert_eq!(src.to_num::<I2F6>(), wrapped);

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 Wrapping<I0F16>, where the return value is always zero.

See also FixedI32::int and FixedU32::int.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
assert_eq!(Wrapping(I16F16::from_num(12.25)).int(), Wrapping(I16F16::from_num(12)));
assert_eq!(Wrapping(I16F16::from_num(-12.25)).int(), Wrapping(I16F16::from_num(-13)));

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 Wrapping<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, Wrapping};
assert_eq!(Wrapping(I16F16::from_num(12.25)).frac(), Wrapping(I16F16::from_num(0.25)));
assert_eq!(Wrapping(I16F16::from_num(-12.25)).frac(), Wrapping(I16F16::from_num(0.75)));

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, Wrapping};
let three = Wrapping(I16F16::from_num(3));
assert_eq!(Wrapping(I16F16::from_num(3.9)).round_to_zero(), three);
assert_eq!(Wrapping(I16F16::from_num(-3.9)).round_to_zero(), -three);

Wrapping ceil. Rounds to the next integer towards +∞, wrapping on overflow.

See also FixedI32::wrapping_ceil and FixedU32::wrapping_ceil.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
let two_half = Wrapping(I16F16::from_num(5) / 2);
assert_eq!(two_half.ceil(), Wrapping(I16F16::from_num(3)));
assert_eq!(Wrapping(I16F16::MAX).ceil(), Wrapping(I16F16::MIN));

Wrapping floor. Rounds to the next integer towards −∞, wrapping on overflow.

Overflow can only occur for signed numbers with zero integer bits.

See also FixedI32::wrapping_floor and FixedU32::wrapping_floor.

Examples
#![feature(generic_const_exprs)]

use fixed::{
    types::{I0F32, I16F16},
    Wrapping,
};
let two_half = Wrapping(I16F16::from_num(5) / 2);
assert_eq!(two_half.floor(), Wrapping(I16F16::from_num(2)));
assert_eq!(Wrapping(I0F32::MIN).floor(), Wrapping(I0F32::ZERO));

Wrapping round. Rounds to the next integer to the nearest, with ties rounded away from zero, and wrapping on overflow.

See also FixedI32::wrapping_round and FixedU32::wrapping_round.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
let two_half = Wrapping(I16F16::from_num(5) / 2);
assert_eq!(two_half.round(), Wrapping(I16F16::from_num(3)));
assert_eq!((-two_half).round(), Wrapping(I16F16::from_num(-3)));
assert_eq!(Wrapping(I16F16::MAX).round(), Wrapping(I16F16::MIN));

Wrapping round. Rounds to the next integer to the nearest, with ties rounded to even, and wrapping on overflow.

See also FixedI32::wrapping_round_ties_to_even and FixedU32::wrapping_round_ties_to_even.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
let two_half = Wrapping(I16F16::from_num(2.5));
assert_eq!(two_half.round_ties_to_even(), Wrapping(I16F16::from_num(2)));
let three_half = Wrapping(I16F16::from_num(3.5));
assert_eq!(three_half.round_ties_to_even(), Wrapping(I16F16::from_num(4)));
let max = Wrapping(I16F16::MAX);
assert_eq!(max.round_ties_to_even(), Wrapping(I16F16::MIN));

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, Wrapping};
let w = Wrapping(I16F16::from_bits(0x00FF_FF00));
assert_eq!(w.count_ones(), w.0.count_ones());

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, Wrapping};
let w = Wrapping(I16F16::from_bits(0x00FF_FF00));
assert_eq!(w.count_zeros(), w.0.count_zeros());

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, Wrapping};
let w = Wrapping(U16F16::from_bits(0xFF00_00FF));
assert_eq!(w.leading_ones(), w.0.leading_ones());

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, Wrapping};
let w = Wrapping(I16F16::from_bits(0x00FF_FF00));
assert_eq!(w.leading_zeros(), w.0.leading_zeros());

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, Wrapping};
let w = Wrapping(U16F16::from_bits(0xFF00_00FF));
assert_eq!(w.trailing_ones(), w.0.trailing_ones());

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, Wrapping};
let w = Wrapping(I16F16::from_bits(0x00FF_FF00));
assert_eq!(w.trailing_zeros(), w.0.trailing_zeros());

Integer base-2 logarithm, rounded down.

See also FixedI32::int_log2 and FixedU32::int_log2.

Panics

Panics if the fixed-point number is ≤ 0.

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, Wrapping};
let i = I16F16::from_bits(0x1234_5678);
assert_eq!(Wrapping(i).reverse_bits(), Wrapping(i.reverse_bits()));

Shifts to the left by n bits, wrapping 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, Wrapping};
let i = I16F16::from_bits(0x00FF_FF00);
assert_eq!(Wrapping(i).rotate_left(12), Wrapping(i.rotate_left(12)));

Shifts to the right by n bits, wrapping 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, Wrapping};
let i = I16F16::from_bits(0x00FF_FF00);
assert_eq!(Wrapping(i).rotate_right(12), Wrapping(i.rotate_right(12)));

Returns true if the number is zero.

See also FixedI32::is_zero and FixedU32::is_zero.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
assert!(Wrapping(I16F16::ZERO).is_zero());
assert!(!Wrapping(I16F16::from_num(4.3)).is_zero());

Returns the distance from self to other.

See also FixedI32::wrapping_dist and FixedU32::wrapping_dist.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
type Wr = Wrapping<I16F16>;
assert_eq!(Wr::from_num(-1).dist(Wr::from_num(4)), Wr::from_num(5));
assert_eq!(Wr::MIN.dist(Wr::MAX), -Wr::DELTA);

Returns the mean of self and other.

See also FixedI32::mean and FixedU32::mean.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
let three = Wrapping(I16F16::from_num(3));
let four = Wrapping(I16F16::from_num(4));
assert_eq!(three.mean(four), Wrapping(I16F16::from_num(3.5)));
assert_eq!(three.mean(-four), Wrapping(I16F16::from_num(-0.5)));

Returns the next multiple of other.

See also FixedI32::wrapping_next_multiple_of and FixedU32::wrapping_next_multiple_of.

Panics

Panics if other is zero.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
let one_point_5 = Wrapping::<I16F16>::from_num(1.5);
let four = Wrapping::<I16F16>::from_num(4);
let four_point_5 = Wrapping::<I16F16>::from_num(4.5);
assert_eq!(four.next_multiple_of(one_point_5), four_point_5);

let max = Wrapping::<I16F16>::MAX;
let max_minus_delta = max - Wrapping::<I16F16>::DELTA;
assert_eq!(max.next_multiple_of(max_minus_delta), max_minus_delta * 2);

Multiply and add. Returns self × mul + add.

See also FixedI32::wrapping_mul_add and FixedU32::wrapping_mul_add.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
let half = Wrapping(I16F16::from_num(0.5));
let three = Wrapping(I16F16::from_num(3));
let four = Wrapping(I16F16::from_num(4));
let max = Wrapping(I16F16::MAX);
assert_eq!(three.mul_add(half, four), Wrapping(I16F16::from_num(5.5)));
assert_eq!(max.mul_add(three, max), max * 4);

Adds self to the product a × b.

See also FixedI32::wrapping_add_prod and FixedU32::wrapping_add_prod.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
let half = Wrapping(I16F16::from_num(0.5));
let three = Wrapping(I16F16::from_num(3));
let four = Wrapping(I16F16::from_num(4));
let max = Wrapping(I16F16::MAX);
assert_eq!(four.add_prod(three, half), Wrapping(I16F16::from_num(5.5)));
assert_eq!(max.add_prod(max, three), max * 4);

Multiply and accumulate. Adds (a × b) to self.

See also FixedI32::wrapping_mul_acc and FixedU32::wrapping_mul_acc.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
let mut acc = Wrapping(I16F16::from_num(3));
acc.mul_acc(Wrapping(I16F16::from_num(4)), Wrapping(I16F16::from_num(0.5)));
assert_eq!(acc, Wrapping(I16F16::from_num(5)));

acc = Wrapping(I16F16::MAX);
acc.mul_acc(Wrapping(I16F16::MAX), Wrapping(I16F16::from_num(3)));
assert_eq!(acc, Wrapping(I16F16::MAX) * 4);

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, Wrapping};
let num = Wrapping(I16F16::from_num(7.5));
let den = Wrapping(I16F16::from_num(2));
assert_eq!(num.rem_euclid(den), Wrapping(I16F16::from_num(1.5)));
assert_eq!((-num).rem_euclid(den), Wrapping(I16F16::from_num(0.5)));

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::wrapping_from_str_binary and FixedU32::wrapping_from_str_binary.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I8F8, Wrapping};
let check = Wrapping(I8F8::from_bits(0b1110001 << (8 - 1)));
assert_eq!(Wrapping::<I8F8>::from_str_binary("101100111000.1"), Ok(check));

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::wrapping_from_str_octal and FixedU32::wrapping_from_str_octal.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I8F8, Wrapping};
let check = Wrapping(I8F8::from_bits(0o1654 << (8 - 3)));
assert_eq!(Wrapping::<I8F8>::from_str_octal("7165.4"), Ok(check));

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::wrapping_from_str_hex and FixedU32::wrapping_from_str_hex.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I8F8, Wrapping};
let check = Wrapping(I8F8::from_bits(0xFFE));
assert_eq!(Wrapping::<I8F8>::from_str_hex("C0F.FE"), Ok(check));

Integer base-10 logarithm, rounded down.

See also FixedI32::int_log10 and FixedU32::int_log10.

Panics

Panics if the fixed-point number is ≤ 0.

Returns the reciprocal (inverse), 1/self.

See also FixedI32::wrapping_recip and FixedU32::wrapping_recip.

Panics

Panics if self is zero.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I8F24, Wrapping};
let quarter = Wrapping(I8F24::from_num(0.25));
let frac_1_512 = Wrapping(I8F24::ONE / 512);
assert_eq!(quarter.recip(), Wrapping(I8F24::from_num(4)));
assert_eq!(frac_1_512.recip(), Wrapping(I8F24::ZERO));

Euclidean division.

See also FixedI32::wrapping_div_euclid and FixedU32::wrapping_div_euclid.

Panics

Panics if the divisor is zero.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
let num = Wrapping(I16F16::from_num(7.5));
let den = Wrapping(I16F16::from_num(2));
assert_eq!(num.div_euclid(den), Wrapping(I16F16::from_num(3)));
let quarter = Wrapping(I16F16::from_num(0.25));
let check = (Wrapping(I16F16::MAX) * 4i32).round_to_zero();
assert_eq!(Wrapping(I16F16::MAX).div_euclid(quarter), check);

Euclidean division by an integer.

See also FixedI32::wrapping_div_euclid_int and FixedU32::wrapping_div_euclid_int.

Panics

Panics if the divisor is zero.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
let num = Wrapping(I16F16::from_num(7.5));
assert_eq!(num.div_euclid_int(2), Wrapping(I16F16::from_num(3)));
let min = Wrapping(I16F16::MIN);
assert_eq!(min.div_euclid_int(-1), min);

Remainder for Euclidean division.

See also FixedI32::wrapping_rem_euclid_int and FixedU32::wrapping_rem_euclid_int.

Panics

Panics if the divisor is zero.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
let num = Wrapping(I16F16::from_num(7.5));
assert_eq!(num.rem_euclid_int(2), Wrapping(I16F16::from_num(1.5)));
assert_eq!((-num).rem_euclid_int(2), Wrapping(I16F16::from_num(0.5)));

Linear interpolation between start and end.

See also FixedI32::wrapping_lerp and FixedU32::wrapping_lerp.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
type Wr = Wrapping<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);

Inverse linear interpolation between start and end.

See also FixedI32::wrapping_inv_lerp and FixedU32::wrapping_inv_lerp.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
type Wr = Wrapping<I16F16>;
assert_eq!(
    Wr::from_num(25).inv_lerp(Wr::from_num(20), Wr::from_num(40)),
    Wr::from_num(0.25)
);

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, Wrapping};
assert_eq!(Wrapping(I4F4::from_num(-3)).signed_bits(), 7);      // “_101.0000”
assert_eq!(Wrapping(I4F4::from_num(-1)).signed_bits(), 5);      // “___1.0000”
assert_eq!(Wrapping(I4F4::from_num(-0.0625)).signed_bits(), 1); // “____.___1”
assert_eq!(Wrapping(I4F4::from_num(0)).signed_bits(), 1);       // “____.___0”
assert_eq!(Wrapping(I4F4::from_num(0.0625)).signed_bits(), 2);  // “____.__01”
assert_eq!(Wrapping(I4F4::from_num(1)).signed_bits(), 6);       // “__01.0000”
assert_eq!(Wrapping(I4F4::from_num(3)).signed_bits(), 7);       // “_011.0000”

Returns true if the number is > 0.

See also FixedI32::is_positive.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
assert!(Wrapping(I16F16::from_num(4.3)).is_positive());
assert!(!Wrapping(I16F16::ZERO).is_positive());
assert!(!Wrapping(I16F16::from_num(-4.3)).is_positive());

Returns true if the number is < 0.

See also FixedI32::is_negative.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
assert!(!Wrapping(I16F16::from_num(4.3)).is_negative());
assert!(!Wrapping(I16F16::ZERO).is_negative());
assert!(Wrapping(I16F16::from_num(-4.3)).is_negative());

Wrapping absolute value. Returns the absolute value, wrapping on overflow.

Overflow can only occur when trying to find the absolute value of the minimum value.

See also FixedI32::wrapping_abs.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::I16F16, Wrapping};
assert_eq!(Wrapping(I16F16::from_num(-5)).abs(), Wrapping(I16F16::from_num(5)));
assert_eq!(Wrapping(I16F16::MIN).abs(), Wrapping(I16F16::MIN));

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 wrapped results.

  • When there are no integer bits, for example for the type Wrapping<I0F16>, the return value is always zero.
  • When there is one integer bit, for example for the type Wrapping<I1F15>, the return value is zero when self is zero, and −1 otherwise. This means that for a positive number, −1 is returned, because +1 does not fit and is wrapped to −1.

See also FixedI32::wrapping_signum.

Examples
#![feature(generic_const_exprs)]

use fixed::{
    types::{I0F32, I1F31, I16F16},
    Wrapping,
};
assert_eq!(Wrapping(<I16F16>::from_num(-3.9)).signum(), Wrapping(I16F16::NEG_ONE));
assert_eq!(Wrapping(<I16F16>::ZERO).signum(), Wrapping(I16F16::ZERO));
assert_eq!(Wrapping(<I16F16>::from_num(3.9)).signum(), Wrapping(I16F16::ONE));

assert_eq!(Wrapping(<I1F31>::from_num(0.5)).signum(), Wrapping(I1F31::NEG_ONE));
assert_eq!(Wrapping(<I0F32>::from_num(0.25)).signum(), Wrapping(I0F32::ZERO));
assert_eq!(Wrapping(<I0F32>::from_num(-0.5)).signum(), Wrapping(I0F32::ZERO));

Addition with an unsigned fixed-point number.

See also FixedI32::wrapping_add_unsigned.

Examples
#![feature(generic_const_exprs)]

use fixed::{
    types::{I16F16, U16F16},
    Wrapping,
};
assert_eq!(
    Wrapping::<I16F16>::from_num(-5).add_unsigned(U16F16::from_num(3)),
    Wrapping::<I16F16>::from_num(-2)
);
assert_eq!(
    Wrapping::<I16F16>::ZERO.add_unsigned(U16F16::MAX),
    -Wrapping::<I16F16>::DELTA
);

Subtraction with an unsigned fixed-point number.

See also FixedI32::wrapping_sub_unsigned.

Examples
#![feature(generic_const_exprs)]

use fixed::{
    types::{I16F16, U16F16},
    Wrapping,
};
assert_eq!(
    Wrapping::<I16F16>::from_num(3).sub_unsigned(U16F16::from_num(5)),
    Wrapping::<I16F16>::from_num(-2)
);
assert_eq!(
    Wrapping::<I16F16>::ZERO.sub_unsigned(U16F16::MAX),
    Wrapping::<I16F16>::DELTA
);

Returns the number of bits required to represent the value.

See also FixedU32::significant_bits.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::U4F4, Wrapping};
assert_eq!(Wrapping(U4F4::from_num(0)).significant_bits(), 0);      // “____.____”
assert_eq!(Wrapping(U4F4::from_num(0.0625)).significant_bits(), 1); // “____.___1”
assert_eq!(Wrapping(U4F4::from_num(1)).significant_bits(), 5);      // “___1.0000”
assert_eq!(Wrapping(U4F4::from_num(3)).significant_bits(), 6);      // “__11.0000”

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, Wrapping};
assert!(Wrapping(U16F16::from_num(0.5)).is_power_of_two());
assert!(Wrapping(U16F16::from_num(4)).is_power_of_two());
assert!(!Wrapping(U16F16::from_num(5)).is_power_of_two());

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, Wrapping};
type T = Wrapping<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);

Returns the smallest power of two that is ≥ self.

If the next power of two is too large to fit, it is wrapped to zero.

See also FixedU32::wrapping_next_power_of_two.

Examples
#![feature(generic_const_exprs)]

use fixed::{types::U16F16, Wrapping};
type T = Wrapping<U16F16>;
assert_eq!(T::from_bits(0b11_0010).next_power_of_two(), T::from_bits(0b100_0000));
assert_eq!(T::from_num(0.3).next_power_of_two(), T::from_num(0.5));
assert_eq!(T::from_num(4).next_power_of_two(), T::from_num(4));
assert_eq!(T::from_num(6.5).next_power_of_two(), T::from_num(8));
// if the next power of two is too large, it is wrapped to zero
assert_eq!(T::MAX.next_power_of_two(), T::ZERO);

Addition with an signed fixed-point number.

See also FixedU32::wrapping_add_signed.

Examples
#![feature(generic_const_exprs)]

use fixed::{
    types::{I16F16, U16F16},
    Wrapping,
};
assert_eq!(
    Wrapping::<U16F16>::from_num(5).add_signed(I16F16::from_num(-3)),
    Wrapping::<U16F16>::from_num(2)
);
assert_eq!(
    Wrapping::<U16F16>::ZERO.add_signed(-I16F16::DELTA),
    Wrapping::<U16F16>::MAX
);

Subtraction with an signed fixed-point number.

See also FixedU32::wrapping_sub_signed.

Examples
#![feature(generic_const_exprs)]

use fixed::{
    types::{I16F16, U16F16},
    Wrapping,
};
assert_eq!(
    Wrapping::<U16F16>::from_num(5).sub_signed(I16F16::from_num(-3)),
    Wrapping::<U16F16>::from_num(8)
);
assert_eq!(
    Wrapping::<U16F16>::ZERO.sub_signed(I16F16::DELTA),
    Wrapping::<U16F16>::MAX
);

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

Performs the += operation. Read more

Performs the += operation. Read more

Performs the += operation. Read more

Performs the += operation. Read more

Generate an arbitrary value of Self from the given unstructured data. Read more

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more

Generate an arbitrary value of Self from the given unstructured data. Read more

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more

Generate an arbitrary value of Self from the given unstructured data. Read more

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more

Generate an arbitrary value of Self from the given unstructured data. Read more

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more

Generate an arbitrary value of Self from the given unstructured data. Read more

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more

Generate an arbitrary value of Self from the given unstructured data. Read more

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more

Generate an arbitrary value of Self from the given unstructured data. Read more

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more

Generate an arbitrary value of Self from the given unstructured data. Read more

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more

Generate an arbitrary value of Self from the given unstructured data. Read more

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more

Generate an arbitrary value of Self from the given unstructured data. Read more

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more

The resulting type after applying the & operator.

Performs the & operation. Read more

The resulting type after applying the & operator.

Performs the & operation. Read more

The resulting type after applying the & operator.

Performs the & operation. Read more

The resulting type after applying the & operator.

Performs the & operation. Read more

Performs the &= operation. Read more

Performs the &= operation. Read more

Performs the &= operation. Read more

Performs the &= operation. Read more

The resulting type after applying the | operator.

Performs the | operation. Read more

The resulting type after applying the | operator.

Performs the | operation. Read more

The resulting type after applying the | operator.

Performs the | operation. Read more

The resulting type after applying the | operator.

Performs the | operation. Read more

Performs the |= operation. Read more

Performs the |= operation. Read more

Performs the |= operation. Read more

Performs the |= operation. Read more

The resulting type after applying the ^ operator.

Performs the ^ operation. Read more

The resulting type after applying the ^ operator.

Performs the ^ operation. Read more

The resulting type after applying the ^ operator.

Performs the ^ operation. Read more

The resulting type after applying the ^ operator.

Performs the ^ operation. Read more

Performs the ^= operation. Read more

Performs the ^= operation. Read more

Performs the ^= operation. Read more

Performs the ^= operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Deserialize this value from the given Serde deserializer. Read more

Deserialize this value from the given Serde deserializer. Read more

Deserialize this value from the given Serde deserializer. Read more

Deserialize this value from the given Serde deserializer. Read more

Deserialize this value from the given Serde deserializer. Read more

Deserialize this value from the given Serde deserializer. Read more

Deserialize this value from the given Serde deserializer. Read more

Deserialize this value from the given Serde deserializer. Read more

Deserialize this value from the given Serde deserializer. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Wraps a fixed-point number.

Parses a string slice containing decimal digits to return a fixed-point number.

Rounding is to the nearest, with ties rounded to even.

The associated error which can be returned from parsing.

Feeds this value into the given Hasher. Read more

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

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The resulting type after applying the ! operator.

Performs the unary ! operation. Read more

The resulting type after applying the ! operator.

Performs the unary ! operation. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Method which takes an iterator and generates Self from the elements by multiplying the items. Read more

Method which takes an iterator and generates Self from the elements by multiplying the items. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Performs the %= operation. Read more

Serialize this value into the given Serde serializer. Read more

Serialize this value into the given Serde serializer. Read more

Serialize this value into the given Serde serializer. Read more

Serialize this value into the given Serde serializer. Read more

Serialize this value into the given Serde serializer. Read more

Serialize this value into the given Serde serializer. Read more

Serialize this value into the given Serde serializer. Read more

Serialize this value into the given Serde serializer. Read more

Serialize this value into the given Serde serializer. Read more

Serialize this value into the given Serde serializer. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

The resulting type after applying the >> operator.

Performs the >> operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

Performs the -= operation. Read more

Performs the -= operation. Read more

Performs the -= operation. Read more

Performs the -= operation. Read more

Method which takes an iterator and generates Self from the elements by “summing up” the items. Read more

Method which takes an iterator and generates Self from the elements by “summing up” the items. Read more

Convert the inner type into the wrapper type.

Convert a reference to the inner type into a reference to the wrapper type. Read more

Convert a mutable reference to the inner type into a mutable reference to the wrapper type. Read more

Convert a slice to the inner type into a slice to the wrapper type.

Convert a mutable slice to the inner type into a mutable slice to the wrapper type. Read more

Convert the wrapper type into the inner type.

Convert a reference to the wrapper type into a reference to the inner type. Read more

Convert a mutable reference to the wrapper type into a mutable reference to the inner type. Read more

Convert a slice to the wrapped type into a slice to the inner type.

Convert a mutable slice to the wrapped type into a mutable slice to the inner type. Read more

Convert the inner type into the wrapper type.

Convert a reference to the inner type into a reference to the wrapper type. Read more

Convert a mutable reference to the inner type into a mutable reference to the wrapper type. Read more

Convert a slice to the inner type into a slice to the wrapper type.

Convert a mutable slice to the inner type into a mutable slice to the wrapper type. Read more

Convert the wrapper type into the inner type.

Convert a reference to the wrapper type into a reference to the inner type. Read more

Convert a mutable reference to the wrapper type into a mutable reference to the inner type. Read more

Convert a slice to the wrapped type into a slice to the inner type.

Convert a mutable slice to the wrapped type into a mutable slice to the inner type. Read more

Convert the inner type into the wrapper type.

Convert a reference to the inner type into a reference to the wrapper type. Read more

Convert a mutable reference to the inner type into a mutable reference to the wrapper type. Read more

Convert a slice to the inner type into a slice to the wrapper type.

Convert a mutable slice to the inner type into a mutable slice to the wrapper type. Read more

Convert the wrapper type into the inner type.

Convert a reference to the wrapper type into a reference to the inner type. Read more

Convert a mutable reference to the wrapper type into a mutable reference to the inner type. Read more

Convert a slice to the wrapped type into a slice to the inner type.

Convert a mutable slice to the wrapped type into a mutable slice to the inner type. Read more

Convert the inner type into the wrapper type.

Convert a reference to the inner type into a reference to the wrapper type. Read more

Convert a mutable reference to the inner type into a mutable reference to the wrapper type. Read more

Convert a slice to the inner type into a slice to the wrapper type.

Convert a mutable slice to the inner type into a mutable slice to the wrapper type. Read more

Convert the wrapper type into the inner type.

Convert a reference to the wrapper type into a reference to the inner type. Read more

Convert a mutable reference to the wrapper type into a mutable reference to the inner type. Read more

Convert a slice to the wrapped type into a slice to the inner type.

Convert a mutable slice to the wrapped type into a mutable slice to the inner type. Read more

Convert the inner type into the wrapper type.

Convert a reference to the inner type into a reference to the wrapper type. Read more

Convert a mutable reference to the inner type into a mutable reference to the wrapper type. Read more

Convert a slice to the inner type into a slice to the wrapper type.

Convert a mutable slice to the inner type into a mutable slice to the wrapper type. Read more

Convert the wrapper type into the inner type.

Convert a reference to the wrapper type into a reference to the inner type. Read more

Convert a mutable reference to the wrapper type into a mutable reference to the inner type. Read more

Convert a slice to the wrapped type into a slice to the inner type.

Convert a mutable slice to the wrapped type into a mutable slice to the inner type. Read more

Convert the inner type into the wrapper type.

Convert a reference to the inner type into a reference to the wrapper type. Read more

Convert a mutable reference to the inner type into a mutable reference to the wrapper type. Read more

Convert a slice to the inner type into a slice to the wrapper type.

Convert a mutable slice to the inner type into a mutable slice to the wrapper type. Read more

Convert the wrapper type into the inner type.

Convert a reference to the wrapper type into a reference to the inner type. Read more

Convert a mutable reference to the wrapper type into a mutable reference to the inner type. Read more

Convert a slice to the wrapped type into a slice to the inner type.

Convert a mutable slice to the wrapped type into a mutable slice to the inner type. Read more

Convert the inner type into the wrapper type.

Convert a reference to the inner type into a reference to the wrapper type. Read more

Convert a mutable reference to the inner type into a mutable reference to the wrapper type. Read more

Convert a slice to the inner type into a slice to the wrapper type.

Convert a mutable slice to the inner type into a mutable slice to the wrapper type. Read more

Convert the wrapper type into the inner type.

Convert a reference to the wrapper type into a reference to the inner type. Read more

Convert a mutable reference to the wrapper type into a mutable reference to the inner type. Read more

Convert a slice to the wrapped type into a slice to the inner type.

Convert a mutable slice to the wrapped type into a mutable slice to the inner type. Read more

Convert the inner type into the wrapper type.

Convert a reference to the inner type into a reference to the wrapper type. Read more

Convert a mutable reference to the inner type into a mutable reference to the wrapper type. Read more

Convert a slice to the inner type into a slice to the wrapper type.

Convert a mutable slice to the inner type into a mutable slice to the wrapper type. Read more

Convert the wrapper type into the inner type.

Convert a reference to the wrapper type into a reference to the inner type. Read more

Convert a mutable reference to the wrapper type into a mutable reference to the inner type. Read more

Convert a slice to the wrapped type into a slice to the inner type.

Convert a mutable slice to the wrapped type into a mutable slice to the inner type. Read more

Convert the inner type into the wrapper type.

Convert a reference to the inner type into a reference to the wrapper type. Read more

Convert a mutable reference to the inner type into a mutable reference to the wrapper type. Read more

Convert a slice to the inner type into a slice to the wrapper type.

Convert a mutable slice to the inner type into a mutable slice to the wrapper type. Read more

Convert the wrapper type into the inner type.

Convert a reference to the wrapper type into a reference to the inner type. Read more

Convert a mutable reference to the wrapper type into a mutable reference to the inner type. Read more

Convert a slice to the wrapped type into a slice to the inner type.

Convert a mutable slice to the wrapped type into a mutable slice to the inner type. Read more

Convert the inner type into the wrapper type.

Convert a reference to the inner type into a reference to the wrapper type. Read more

Convert a mutable reference to the inner type into a mutable reference to the wrapper type. Read more

Convert a slice to the inner type into a slice to the wrapper type.

Convert a mutable slice to the inner type into a mutable slice to the wrapper type. Read more

Convert the wrapper type into the inner type.

Convert a reference to the wrapper type into a reference to the inner type. Read more

Convert a mutable reference to the wrapper type into a mutable reference to the inner type. Read more

Convert a slice to the wrapped type into a slice to the inner type.

Convert a mutable slice to the wrapped type into a mutable slice to the inner type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Casts the value.

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern. Read more

If this function returns true, then it must be valid to reinterpret bits as &Self. Read more

Casts the value.

Returns the argument unchanged.

Calls U::from(self).

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

Performs the conversion.

Performs the conversion.

Casts the value.

Casts the value.

Casts the value.

Casts the value.

The resulting type after obtaining ownership.

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

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Casts the value.

Casts the value.

Casts the value.

Casts the value.