Struct hwlocality::ffi::PositiveInt
source · pub struct PositiveInt(/* private fields */);
Expand description
Integer ranging from 0 to the implementation-defined c_int::MAX
limit
On all platforms currently supported by Rust, the upper limit is at least
32767 (2^15-1
). If we leave aside the edge case of 16-bit hardware, it
will usually be equal to 2147483647 (2^31-1
), but could potentially be
greater.
§External operators
Almost all binary operators have an overload with exactly one of isize or usize (depending on whether a negative operand makes sense) in order to allow them to be used with integer literals without the type inference errors that implementations for multiple integer types would bring.
The exception is left and right shifts: following the example of primitive integer types, we overload these for all integer types and references thereof.
Like primitive integer types, we overload all arithmetic operators for references and values of each operand type for convenience. This convenience does not extend to non-arithmetic operations like type conversions and comparisons.
Assuming a binary operator A op B
is defined for two different types A and
B, we also define B op A
if both operands play a symmetric role. We do
not generally do so otherwise as the result could be confusing (e.g. it
seems fair to expect PositiveInt << usize
to be a PositiveInt
, but by
the same logic usize << PositiveInt
should be an usize
, not a
PositiveInt
).
Implementations§
source§impl PositiveInt
impl PositiveInt
sourcepub const EFFECTIVE_BITS: u32 = 31u32
pub const EFFECTIVE_BITS: u32 = 31u32
Effective size of this integer type in bits
The actual storage uses more bits for hardware reasons, which is why
this is not called BITS
like the other integer::BITS
as such naming
could be misinterpreted by careless users.
sourcepub fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>
pub fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>
Converts a string slice in a given base to an integer
The string is expected to be an optional +
sign followed by digits.
Leading and trailing whitespace represent an error. Digits are a subset
of these characters, depending on radix
:
0-9
a-z
A-Z
§Panics
This function panics if radix
is not in the range from 2 to 36.
§Errors
ParseIntError
if src
is not a base-radix
number smaller than
PositiveInt::MAX
.
§Examples
Basic usage:
assert_eq!(PositiveInt::from_str_radix("0", 16), Ok(PositiveInt::ZERO));
sourcepub const fn count_ones(self) -> u32
pub const fn count_ones(self) -> u32
Returns the number of ones in the binary representation of self
§Examples
Basic usage:
assert_eq!(PositiveInt::ZERO.count_ones(), 0);
assert_eq!(PositiveInt::ONE.count_ones(), 1);
assert_eq!(PositiveInt::MAX.count_ones(), PositiveInt::EFFECTIVE_BITS);
sourcepub const fn count_zeros(self) -> u32
pub const fn count_zeros(self) -> u32
Returns the number of zeros in the binary representation of self
§Examples
Basic usage:
assert_eq!(PositiveInt::ZERO.count_zeros(), PositiveInt::EFFECTIVE_BITS);
assert_eq!(PositiveInt::ONE.count_zeros(), PositiveInt::EFFECTIVE_BITS - 1);
assert_eq!(PositiveInt::MAX.count_zeros(), 0);
sourcepub const fn leading_zeros(self) -> u32
pub const fn leading_zeros(self) -> u32
Returns the number of leading zeros in the binary representation of
self
.
Depending on what you’re doing with the value, you might also be
interested in the ilog2()
function which returns a consistent
number, even if the type widens.
§Examples
Basic usage:
assert_eq!(PositiveInt::ZERO.leading_zeros(), PositiveInt::EFFECTIVE_BITS);
assert_eq!(PositiveInt::ONE.leading_zeros(), PositiveInt::EFFECTIVE_BITS - 1);
assert_eq!(PositiveInt::MAX.leading_zeros(), 0);
sourcepub const fn trailing_zeros(self) -> u32
pub const fn trailing_zeros(self) -> u32
Returns the number of trailing zeros in the binary representation of
self
.
§Examples
Basic usage:
assert_eq!(PositiveInt::ZERO.trailing_zeros(), PositiveInt::EFFECTIVE_BITS);
assert_eq!(PositiveInt::ONE.trailing_zeros(), 0);
assert_eq!(PositiveInt::MAX.trailing_zeros(), 0);
sourcepub const fn leading_ones(self) -> u32
pub const fn leading_ones(self) -> u32
Returns the number of leading ones in the binary representation of
self
.
§Examples
Basic usage:
assert_eq!(PositiveInt::ZERO.leading_ones(), 0);
assert_eq!(PositiveInt::ONE.leading_ones(), 0);
assert_eq!(PositiveInt::MAX.leading_ones(), PositiveInt::EFFECTIVE_BITS);
sourcepub const fn trailing_ones(self) -> u32
pub const fn trailing_ones(self) -> u32
Returns the number of trailing ones in the binary representation of
self
.
§Examples
Basic usage:
assert_eq!(PositiveInt::ZERO.trailing_ones(), 0);
assert_eq!(PositiveInt::ONE.trailing_ones(), 1);
assert_eq!(PositiveInt::MAX.trailing_ones(), PositiveInt::EFFECTIVE_BITS);
sourcepub const fn rotate_left(self, n: u32) -> Self
pub const fn rotate_left(self, n: u32) -> Self
Shifts the bits to the left by a specified amount, n
, wrapping the
truncated bits to the end of the resulting integer.
Please note this isn’t the same operation as the <<
shifting operator!
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.rotate_left(129),
PositiveInt::ZERO
);
assert_eq!(
PositiveInt::ONE.rotate_left(129),
PositiveInt::ONE << (129 % PositiveInt::EFFECTIVE_BITS)
);
assert_eq!(
PositiveInt::MAX.rotate_left(129),
PositiveInt::MAX
);
sourcepub const fn rotate_right(self, n: u32) -> Self
pub const fn rotate_right(self, n: u32) -> Self
Shifts the bits to the right by a specified amount, n
, wrapping the
truncated bits to the beginning of the resulting integer.
Please note this isn’t the same operation as the >>
shifting operator!
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.rotate_right(129),
PositiveInt::ZERO
);
let effective_rotate = 129 % PositiveInt::EFFECTIVE_BITS;
assert_eq!(
PositiveInt::ONE.rotate_right(129),
PositiveInt::ONE << (PositiveInt::EFFECTIVE_BITS - effective_rotate)
);
assert_eq!(
PositiveInt::MAX.rotate_right(129),
PositiveInt::MAX
);
sourcepub const fn reverse_bits(self) -> Self
pub const fn reverse_bits(self) -> Self
Reverses the order of bits in the integer. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.reverse_bits(),
PositiveInt::ZERO
);
assert_eq!(
PositiveInt::ONE.reverse_bits(),
PositiveInt::ONE << PositiveInt::EFFECTIVE_BITS - 1
);
assert_eq!(
PositiveInt::MAX.reverse_bits(),
PositiveInt::MAX
);
sourcepub const fn checked_add(self, rhs: Self) -> Option<Self>
pub const fn checked_add(self, rhs: Self) -> Option<Self>
Checked integer addition. Computes self + rhs
, returning None
if
overflow occurred.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.checked_add(PositiveInt::ZERO),
Some(PositiveInt::ZERO)
);
assert_eq!(
PositiveInt::ZERO.checked_add(PositiveInt::MAX),
Some(PositiveInt::MAX)
);
assert_eq!(
PositiveInt::ONE.checked_add(PositiveInt::ONE),
PositiveInt::try_from(2).ok()
);
assert_eq!(
PositiveInt::ONE.checked_add(PositiveInt::MAX),
None
);
assert_eq!(
PositiveInt::MAX.checked_add(PositiveInt::ZERO),
Some(PositiveInt::MAX)
);
assert_eq!(
PositiveInt::MAX.checked_add(PositiveInt::ONE),
None
);
sourcepub const fn checked_add_signed(self, rhs: isize) -> Option<Self>
pub const fn checked_add_signed(self, rhs: isize) -> Option<Self>
Checked addition with a signed integer. Computes self + rhs
, returning
None
if overflow occurred.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.checked_add_signed(0),
Some(PositiveInt::ZERO)
);
assert_eq!(
PositiveInt::ZERO.checked_add_signed(1),
Some(PositiveInt::ONE)
);
assert_eq!(
PositiveInt::MIN.checked_add_signed(-1),
None
);
assert_eq!(
PositiveInt::MAX.checked_add_signed(0),
Some(PositiveInt::MAX)
);
assert_eq!(
PositiveInt::MAX.checked_add_signed(1),
None
);
sourcepub const fn checked_sub(self, rhs: Self) -> Option<Self>
pub const fn checked_sub(self, rhs: Self) -> Option<Self>
Checked integer subtraction. Computes self - rhs
, returning None
if
overflow occurred.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.checked_sub(PositiveInt::ZERO),
Some(PositiveInt::ZERO)
);
assert_eq!(
PositiveInt::MIN.checked_sub(PositiveInt::ONE),
None
);
assert_eq!(
PositiveInt::MAX.checked_sub(PositiveInt::ZERO),
Some(PositiveInt::MAX)
);
assert_eq!(
PositiveInt::MAX.checked_sub(PositiveInt::MAX),
Some(PositiveInt::ZERO)
);
sourcepub const fn checked_mul(self, rhs: Self) -> Option<Self>
pub const fn checked_mul(self, rhs: Self) -> Option<Self>
Checked integer multiplication. Computes self * rhs
, returning None
if overflow occurred.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.checked_mul(PositiveInt::ONE),
Some(PositiveInt::ZERO)
);
assert_eq!(
PositiveInt::ZERO.checked_mul(PositiveInt::MAX),
Some(PositiveInt::ZERO)
);
assert_eq!(
PositiveInt::ONE.checked_mul(PositiveInt::ONE),
Some(PositiveInt::ONE)
);
assert_eq!(
PositiveInt::ONE.checked_mul(PositiveInt::MAX),
Some(PositiveInt::MAX)
);
assert_eq!(
PositiveInt::MAX.checked_mul(PositiveInt::ZERO),
Some(PositiveInt::ZERO)
);
assert_eq!(
PositiveInt::MAX.checked_mul(PositiveInt::MAX),
None
);
sourcepub const fn checked_div(self, rhs: Self) -> Option<Self>
pub const fn checked_div(self, rhs: Self) -> Option<Self>
Checked integer division. Computes self / rhs
, returning None
if rhs == Self::ZERO
.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.checked_div(PositiveInt::ZERO),
None
);
assert_eq!(
PositiveInt::ZERO.checked_div(PositiveInt::ONE),
Some(PositiveInt::ZERO)
);
assert_eq!(
PositiveInt::MAX.checked_div(PositiveInt::ZERO),
None
);
assert_eq!(
PositiveInt::MAX.checked_div(PositiveInt::MAX),
Some(PositiveInt::ONE)
);
sourcepub const fn checked_div_euclid(self, rhs: Self) -> Option<Self>
pub const fn checked_div_euclid(self, rhs: Self) -> Option<Self>
Checked Euclidean division. Computes self / rhs
, returning None
if rhs == Self::ZERO
. Equivalent to integer division for this type.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.checked_div_euclid(PositiveInt::ZERO),
None
);
assert_eq!(
PositiveInt::ZERO.checked_div_euclid(PositiveInt::ONE),
Some(PositiveInt::ZERO)
);
assert_eq!(
PositiveInt::MAX.checked_div_euclid(PositiveInt::ZERO),
None
);
assert_eq!(
PositiveInt::MAX.checked_div_euclid(PositiveInt::MAX),
Some(PositiveInt::ONE)
);
sourcepub const fn checked_rem(self, rhs: Self) -> Option<Self>
pub const fn checked_rem(self, rhs: Self) -> Option<Self>
Checked integer remainder. Computes self % rhs
, returning None
if rhs == Self::ZERO
.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.checked_rem(PositiveInt::ZERO),
None
);
assert_eq!(
PositiveInt::ZERO.checked_rem(PositiveInt::ONE),
Some(PositiveInt::ZERO)
);
assert_eq!(
PositiveInt::MAX.checked_rem(PositiveInt::ZERO),
None
);
assert_eq!(
PositiveInt::MAX.checked_rem(PositiveInt::MAX),
Some(PositiveInt::ZERO)
);
sourcepub const fn checked_rem_euclid(self, rhs: Self) -> Option<Self>
pub const fn checked_rem_euclid(self, rhs: Self) -> Option<Self>
Checked Euclidean remainder. Computes self % rhs
, returning None
if rhs == Self::ZERO
. Equivalent to integer remainder for this type.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.checked_rem_euclid(PositiveInt::ZERO),
None
);
assert_eq!(
PositiveInt::ZERO.checked_rem_euclid(PositiveInt::ONE),
Some(PositiveInt::ZERO)
);
assert_eq!(
PositiveInt::MAX.checked_rem_euclid(PositiveInt::ZERO),
None
);
assert_eq!(
PositiveInt::MAX.checked_rem_euclid(PositiveInt::MAX),
Some(PositiveInt::ZERO)
);
sourcepub const fn ilog(self, base: Self) -> u32
pub const fn ilog(self, base: Self) -> u32
Returns the logarithm of the number with respect to an arbitrary base, rounded down.
This method might not be optimized owing to implementation details;
ilog2()
can produce results more efficiently for base 2, and
ilog10()
can produce results more efficiently for base 10.
§Panics
This function will panic if self
is zero, or if base
is less than 2.
§Examples
assert_eq!(
PositiveInt::ONE.ilog(PositiveInt::MAX),
0
);
assert_eq!(
PositiveInt::MAX.ilog(PositiveInt::MAX),
1
);
sourcepub const fn checked_ilog(self, base: Self) -> Option<u32>
pub const fn checked_ilog(self, base: Self) -> Option<u32>
Returns the logarithm of the number with respect to an arbitrary base, rounded down.
Returns None
if the number is zero, or if the base is not at least 2.
This method might not be optimized owing to implementation details;
checked_ilog2()
can produce results more efficiently for base 2, and
checked_ilog10()
can produce results more efficiently for base 10.
§Examples
assert_eq!(
PositiveInt::ZERO.checked_ilog(PositiveInt::ONE),
None
);
assert_eq!(
PositiveInt::ONE.checked_ilog(PositiveInt::MAX),
Some(0)
);
assert_eq!(
PositiveInt::MAX.checked_ilog(PositiveInt::ZERO),
None
);
assert_eq!(
PositiveInt::MAX.checked_ilog(PositiveInt::MAX),
Some(1)
);
sourcepub const fn checked_ilog2(self) -> Option<u32>
pub const fn checked_ilog2(self) -> Option<u32>
Returns the base 2 logarithm of the number, rounded down.
Returns None
if the number is zero.
§Examples
assert_eq!(
PositiveInt::ZERO.checked_ilog2(),
None
);
assert_eq!(
PositiveInt::ONE.checked_ilog2(),
Some(0)
);
assert_eq!(
PositiveInt::MAX.checked_ilog2(),
Some(PositiveInt::EFFECTIVE_BITS - 1)
);
sourcepub const fn checked_ilog10(self) -> Option<u32>
pub const fn checked_ilog10(self) -> Option<u32>
Returns the base 10 logarithm of the number, rounded down.
Returns None
if the number is zero.
§Examples
assert_eq!(
PositiveInt::ZERO.checked_ilog10(),
None
);
assert_eq!(
PositiveInt::ONE.checked_ilog10(),
Some(0)
);
assert_eq!(
PositiveInt::try_from(100).ok().and_then(PositiveInt::checked_ilog10),
Some(2)
);
sourcepub const fn checked_neg(self) -> Option<Self>
pub const fn checked_neg(self) -> Option<Self>
Checked negation. Computes -self
, returning None
unless self == 0
.
Note that negating any positive integer will overflow.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.checked_neg(),
Some(PositiveInt::ZERO)
);
assert_eq!(
PositiveInt::ONE.checked_neg(),
None
);
assert_eq!(
PositiveInt::MAX.checked_neg(),
None
);
sourcepub const fn checked_shl(self, rhs: u32) -> Option<Self>
pub const fn checked_shl(self, rhs: u32) -> Option<Self>
Checked shift left. Computes self << rhs
, returning None
if rhs
is
larger than or equal to Self::EFFECTIVE_BITS
.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.checked_shl(1),
Some(PositiveInt::ZERO)
);
assert_eq!(
PositiveInt::ZERO.checked_shl(PositiveInt::EFFECTIVE_BITS),
None
);
assert_eq!(
PositiveInt::ONE.checked_shl(1),
PositiveInt::try_from(2).ok()
);
assert_eq!(
PositiveInt::MAX.checked_shl(0),
Some(PositiveInt::MAX)
);
assert_eq!(
PositiveInt::MAX.checked_shl(1),
Some((PositiveInt::MAX / 2) * 2)
);
assert_eq!(
PositiveInt::MAX.checked_shl(PositiveInt::EFFECTIVE_BITS),
None
);
sourcepub const fn checked_shr(self, rhs: u32) -> Option<Self>
pub const fn checked_shr(self, rhs: u32) -> Option<Self>
Checked shift right. Computes self >> rhs
, returning None
if rhs
is larger than or equal to Self::EFFECTIVE_BITS
.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.checked_shr(1),
Some(PositiveInt::ZERO)
);
assert_eq!(
PositiveInt::ZERO.checked_shr(PositiveInt::EFFECTIVE_BITS),
None
);
assert_eq!(
PositiveInt::ONE.checked_shr(1),
Some(PositiveInt::ZERO)
);
assert_eq!(
PositiveInt::MAX.checked_shr(0),
Some(PositiveInt::MAX)
);
assert_eq!(
PositiveInt::MAX.checked_shr(1),
Some(PositiveInt::MAX / 2)
);
assert_eq!(
PositiveInt::MAX.checked_shr(PositiveInt::EFFECTIVE_BITS),
None
);
sourcepub const fn checked_pow(self, exp: u32) -> Option<Self>
pub const fn checked_pow(self, exp: u32) -> Option<Self>
Checked exponentiation. Computes self.pow(exp)
, returning None
if
overflow occurred.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.checked_pow(0),
Some(PositiveInt::ONE)
);
assert_eq!(
PositiveInt::ONE.checked_pow(3),
Some(PositiveInt::ONE)
);
assert_eq!(
PositiveInt::MAX.checked_pow(1),
Some(PositiveInt::MAX)
);
assert_eq!(
PositiveInt::MAX.checked_pow(2),
None
);
sourcepub const fn saturating_add(self, rhs: Self) -> Self
pub const fn saturating_add(self, rhs: Self) -> Self
Saturating integer addition. Computes self + rhs
, saturating at the
numeric bounds instead of overflowing.
§Examples
Basic usage:
assert_eq!(
PositiveInt::MIN.saturating_add(PositiveInt::ZERO),
PositiveInt::MIN
);
assert_eq!(
PositiveInt::ONE.saturating_add(PositiveInt::ZERO),
PositiveInt::ONE
);
assert_eq!(
PositiveInt::ONE.saturating_add(PositiveInt::MAX),
PositiveInt::MAX
);
assert_eq!(
PositiveInt::MAX.saturating_add(PositiveInt::MAX),
PositiveInt::MAX
);
sourcepub const fn saturating_add_signed(self, rhs: isize) -> Self
pub const fn saturating_add_signed(self, rhs: isize) -> Self
Saturating addition with a signed integer. Computes self + rhs
,
saturating at the numeric bounds instead of overflowing.
§Examples
Basic usage:
assert_eq!(
PositiveInt::MIN.saturating_add_signed(0),
PositiveInt::MIN
);
assert_eq!(
PositiveInt::MIN.saturating_add_signed(-1),
PositiveInt::MIN
);
assert_eq!(
PositiveInt::MAX.saturating_add_signed(0),
PositiveInt::MAX
);
assert_eq!(
PositiveInt::MAX.saturating_add_signed(1),
PositiveInt::MAX
);
sourcepub const fn saturating_sub(self, rhs: Self) -> Self
pub const fn saturating_sub(self, rhs: Self) -> Self
Saturating integer subtraction. Computes self - rhs
, saturating at the
numeric bounds instead of overflowing.
§Examples
Basic usage:
assert_eq!(
PositiveInt::MIN.saturating_sub(PositiveInt::ZERO),
PositiveInt::MIN
);
assert_eq!(
PositiveInt::MIN.saturating_sub(PositiveInt::MAX),
PositiveInt::MIN
);
assert_eq!(
PositiveInt::MAX.saturating_sub(PositiveInt::ZERO),
PositiveInt::MAX
);
assert_eq!(
PositiveInt::MAX.saturating_sub(PositiveInt::MAX),
PositiveInt::ZERO
);
sourcepub const fn saturating_mul(self, rhs: Self) -> Self
pub const fn saturating_mul(self, rhs: Self) -> Self
Saturating integer multiplication. Computes self * rhs
, saturating at
the numeric bounds instead of overflowing.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.saturating_mul(PositiveInt::ZERO),
PositiveInt::ZERO
);
assert_eq!(
PositiveInt::ZERO.saturating_mul(PositiveInt::MAX),
PositiveInt::ZERO
);
assert_eq!(
PositiveInt::MAX.saturating_mul(PositiveInt::ONE),
PositiveInt::MAX
);
assert_eq!(
PositiveInt::MAX.saturating_mul(PositiveInt::MAX),
PositiveInt::MAX
);
sourcepub const fn saturating_div(self, rhs: Self) -> Self
pub const fn saturating_div(self, rhs: Self) -> Self
Saturating integer division. Identical to self / rhs
for this
unsigned integer type
§Examples
Basic usage:
assert_eq!(
PositiveInt::ONE.saturating_div(PositiveInt::MAX),
PositiveInt::ZERO
);
assert_eq!(
PositiveInt::MAX.saturating_div(PositiveInt::MAX),
PositiveInt::ONE
);
sourcepub const fn saturating_pow(self, exp: u32) -> Self
pub const fn saturating_pow(self, exp: u32) -> Self
Saturating integer exponentiation. Computes self.pow(rhs)
, saturating
at the numeric bounds instead of overflowing.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.saturating_pow(0),
PositiveInt::ONE
);
assert_eq!(
PositiveInt::ZERO.saturating_pow(2),
PositiveInt::ZERO
);
assert_eq!(
PositiveInt::ONE.saturating_pow(3),
PositiveInt::ONE
);
assert_eq!(
PositiveInt::MAX.saturating_pow(1),
PositiveInt::MAX
);
assert_eq!(
PositiveInt::MAX.saturating_pow(2),
PositiveInt::MAX
);
sourcepub const fn wrapping_add(self, rhs: Self) -> Self
pub const fn wrapping_add(self, rhs: Self) -> Self
Wrapping (modular) addition. Computes self + rhs
, wrapping around at
the boundary of the type.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.wrapping_add(PositiveInt::ZERO),
PositiveInt::ZERO
);
assert_eq!(
PositiveInt::ZERO.wrapping_add(PositiveInt::MAX),
PositiveInt::MAX
);
assert_eq!(
PositiveInt::ONE.wrapping_add(PositiveInt::MAX),
PositiveInt::ZERO
);
assert_eq!(
PositiveInt::MAX.wrapping_add(PositiveInt::ZERO),
PositiveInt::MAX
);
assert_eq!(
PositiveInt::MAX.wrapping_add(PositiveInt::MAX),
PositiveInt::MAX - 1
);
sourcepub const fn wrapping_add_signed(self, rhs: isize) -> Self
pub const fn wrapping_add_signed(self, rhs: isize) -> Self
Wrapping (modular) addition with a signed integer. Computes self + rhs
, wrapping around at the boundary of the type.
§Examples
Basic usage:
assert_eq!(
PositiveInt::MIN.wrapping_add_signed(0),
PositiveInt::MIN
);
assert_eq!(
PositiveInt::MIN.wrapping_add_signed(-1),
PositiveInt::MAX
);
assert_eq!(
PositiveInt::MAX.wrapping_add_signed(0),
PositiveInt::MAX
);
assert_eq!(
PositiveInt::MAX.wrapping_add_signed(1),
PositiveInt::MIN
);
sourcepub const fn wrapping_sub(self, rhs: Self) -> Self
pub const fn wrapping_sub(self, rhs: Self) -> Self
Wrapping (modular) subtraction. Computes self - rhs
, wrapping around
at the boundary of the type.
§Examples
Basic usage:
assert_eq!(
PositiveInt::MIN.wrapping_sub(PositiveInt::ZERO),
PositiveInt::MIN
);
assert_eq!(
PositiveInt::MIN.wrapping_sub(PositiveInt::ONE),
PositiveInt::MAX
);
assert_eq!(
PositiveInt::MIN.wrapping_sub(PositiveInt::MAX),
PositiveInt::ONE
);
assert_eq!(
PositiveInt::MAX.wrapping_sub(PositiveInt::ZERO),
PositiveInt::MAX
);
assert_eq!(
PositiveInt::MAX.wrapping_sub(PositiveInt::MAX),
PositiveInt::ZERO
);
sourcepub const fn wrapping_mul(self, rhs: Self) -> Self
pub const fn wrapping_mul(self, rhs: Self) -> Self
Wrapping (modular) multiplication. Computes self * rhs
, wrapping
around at the boundary of the type.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.wrapping_mul(PositiveInt::ZERO),
PositiveInt::ZERO
);
assert_eq!(
PositiveInt::ZERO.wrapping_mul(PositiveInt::MAX),
PositiveInt::ZERO
);
assert_eq!(
PositiveInt::MAX.wrapping_mul(PositiveInt::ZERO),
PositiveInt::ZERO
);
assert_eq!(
PositiveInt::MAX.wrapping_mul(PositiveInt::MAX),
PositiveInt::ONE
);
sourcepub const fn wrapping_div(self, rhs: Self) -> Self
pub const fn wrapping_div(self, rhs: Self) -> Self
Wrapping (modular) division. Computes self / rhs
. Wrapped division on
unsigned types is just normal division. There’s no way wrapping could
ever happen. This function exists, so that all operations are accounted
for in the wrapping operations.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ONE.wrapping_div(PositiveInt::MAX),
PositiveInt::ZERO
);
assert_eq!(
PositiveInt::MAX.wrapping_div(PositiveInt::MAX),
PositiveInt::ONE
);
sourcepub const fn wrapping_div_euclid(self, rhs: Self) -> Self
pub const fn wrapping_div_euclid(self, rhs: Self) -> Self
Wrapping Euclidean division. Computes self.div_euclid(rhs)
. Wrapped
division on unsigned types is just normal division. There’s no way
wrapping could ever happen. This function exists, so that all
operations are accounted for in the wrapping operations. Since, for the
positive integers, all common definitions of division are equal, this
is exactly equal to self.wrapping_div(rhs)
.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ONE.wrapping_div_euclid(PositiveInt::MAX),
PositiveInt::ZERO
);
assert_eq!(
PositiveInt::MAX.wrapping_div_euclid(PositiveInt::MAX),
PositiveInt::ONE
);
sourcepub const fn wrapping_rem(self, rhs: Self) -> Self
pub const fn wrapping_rem(self, rhs: Self) -> Self
Wrapping (modular) remainder. Computes self % rhs
. Wrapped remainder
calculation on unsigned types is just the regular remainder
calculation. There’s no way wrapping could ever happen. This function
exists, so that all operations are accounted for in the wrapping
operations.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ONE.wrapping_rem(PositiveInt::MAX),
PositiveInt::ONE
);
assert_eq!(
PositiveInt::MAX.wrapping_rem(PositiveInt::MAX),
PositiveInt::ZERO
);
sourcepub const fn wrapping_rem_euclid(self, rhs: Self) -> Self
pub const fn wrapping_rem_euclid(self, rhs: Self) -> Self
Wrapping Euclidean modulo. Computes self.rem_euclid(rhs)
. Wrapped
modulo calculation on unsigned types is just the regular remainder
calculation. There’s no way wrapping could ever happen. This function
exists, so that all operations are accounted for in the wrapping
operations. Since, for the positive integers, all common definitions of
division are equal, this is exactly equal to self.wrapping_rem(rhs)
.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ONE.wrapping_rem_euclid(PositiveInt::MAX),
PositiveInt::ONE
);
assert_eq!(
PositiveInt::MAX.wrapping_rem_euclid(PositiveInt::MAX),
PositiveInt::ZERO
);
sourcepub const fn wrapping_neg(self) -> Self
pub const fn wrapping_neg(self) -> Self
Wrapping (modular) negation. Computes -self
, wrapping around at the
boundary of the type.
Since unsigned types do not have negative equivalents all applications
of this function will wrap (except for -0
). For values smaller than
the corresponding signed type’s maximum the result is the same as
casting the corresponding signed value. Any larger values are
equivalent to MAX + 1 - (val - MAX - 1)
where MAX
is the
corresponding signed type’s maximum.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.wrapping_neg(),
PositiveInt::ZERO
);
assert_eq!(
PositiveInt::ONE.wrapping_neg(),
PositiveInt::MAX
);
assert_eq!(
PositiveInt::MAX.wrapping_neg(),
PositiveInt::ONE
);
sourcepub const fn wrapping_shl(self, rhs: u32) -> Self
pub const fn wrapping_shl(self, rhs: u32) -> Self
Panic-free bitwise shift-left; yields self << (rhs % Self::EFFECTIVE_BITS)
.
Note that this is not the same as a rotate-left; the RHS of a wrapping
shift-left is restricted to the range of the type, rather than the bits
shifted out of the LHS being returned to the other end. This type also
implements a rotate_left
function, which may be what
you want instead.
§Examples
Basic usage:
assert_eq!(
PositiveInt::MAX.wrapping_shl(PositiveInt::EFFECTIVE_BITS - 1),
PositiveInt::MAX << (PositiveInt::EFFECTIVE_BITS - 1)
);
assert_eq!(
PositiveInt::MAX.wrapping_shl(PositiveInt::EFFECTIVE_BITS),
PositiveInt::MAX
);
assert_eq!(
PositiveInt::MAX.wrapping_shl(PositiveInt::EFFECTIVE_BITS + 1),
PositiveInt::MAX << 1
);
sourcepub const fn wrapping_shr(self, rhs: u32) -> Self
pub const fn wrapping_shr(self, rhs: u32) -> Self
Panic-free bitwise shift-right; yields self >> (rhs % Self::EFFECTIVE_BITS)
.
Note that this is not the same as a rotate-right; the RHS of a
wrapping shift-right is restricted to the range of the type, rather
than the bits shifted out of the LHS being returned to the other end.
This type also implements a rotate_right
function, which may be what
you want instead.
§Examples
Basic usage:
assert_eq!(
PositiveInt::MAX.wrapping_shr(PositiveInt::EFFECTIVE_BITS - 1),
PositiveInt::MAX >> (PositiveInt::EFFECTIVE_BITS - 1)
);
assert_eq!(
PositiveInt::MAX.wrapping_shr(PositiveInt::EFFECTIVE_BITS),
PositiveInt::MAX
);
assert_eq!(
PositiveInt::MAX.wrapping_shr(PositiveInt::EFFECTIVE_BITS + 1),
PositiveInt::MAX >> 1
);
sourcepub const fn wrapping_pow(self, exp: u32) -> Self
pub const fn wrapping_pow(self, exp: u32) -> Self
Wrapping (modular) exponentiation. Computes self.pow(exp)
, wrapping
around at the boundary of the type.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.wrapping_pow(0),
PositiveInt::ONE
);
assert_eq!(
PositiveInt::ONE.wrapping_pow(3),
PositiveInt::ONE
);
assert_eq!(
PositiveInt::MAX.wrapping_pow(1),
PositiveInt::MAX
);
assert_eq!(
PositiveInt::MAX.wrapping_pow(2),
PositiveInt::ONE
);
sourcepub const fn overflowing_add(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_add(self, rhs: Self) -> (Self, bool)
Calculates self
+ rhs
Returns a tuple of the addition along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
§Examples
Basic usage:
assert_eq!(
PositiveInt::MIN.overflowing_add(PositiveInt::ZERO),
(PositiveInt::MIN, false)
);
assert_eq!(
PositiveInt::ZERO.overflowing_add(PositiveInt::MAX),
(PositiveInt::MAX, false)
);
assert_eq!(
PositiveInt::MAX.overflowing_add(PositiveInt::ZERO),
(PositiveInt::MAX, false)
);
assert_eq!(
PositiveInt::MAX.overflowing_add(PositiveInt::ONE),
(PositiveInt::MIN, true)
);
sourcepub const fn overflowing_add_signed(self, rhs: isize) -> (Self, bool)
pub const fn overflowing_add_signed(self, rhs: isize) -> (Self, bool)
Calculates self
+ rhs
with a signed rhs
.
Returns a tuple of the addition along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
§Examples
Basic usage:
assert_eq!(
PositiveInt::MIN.overflowing_add_signed(0),
(PositiveInt::MIN, false)
);
assert_eq!(
PositiveInt::MIN.overflowing_add_signed(-1),
(PositiveInt::MAX, true)
);
assert_eq!(
PositiveInt::MAX.overflowing_add_signed(0),
(PositiveInt::MAX, false)
);
assert_eq!(
PositiveInt::MAX.overflowing_add_signed(1),
(PositiveInt::MIN, true)
);
sourcepub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool)
Calculates self
- rhs
Returns a tuple of the addition along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
§Examples
Basic usage:
assert_eq!(
PositiveInt::MIN.overflowing_sub(PositiveInt::ZERO),
(PositiveInt::MIN, false)
);
assert_eq!(
PositiveInt::MIN.overflowing_sub(PositiveInt::ONE),
(PositiveInt::MAX, true)
);
assert_eq!(
PositiveInt::MAX.overflowing_sub(PositiveInt::ZERO),
(PositiveInt::MAX, false)
);
assert_eq!(
PositiveInt::MAX.overflowing_sub(PositiveInt::MAX),
(PositiveInt::ZERO, false)
);
sourcepub const fn abs_diff(self, other: Self) -> Self
pub const fn abs_diff(self, other: Self) -> Self
Computes the absolute difference between self
and other
.
§Examples
Basic usage:
let big = PositiveInt::MAX;
let small = PositiveInt::ONE;
assert_eq!(
big.abs_diff(small),
big - small
);
assert_eq!(
small.abs_diff(big),
big - small
);
sourcepub const fn overflowing_mul(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool)
Calculates the multiplication of self
and rhs
.
Returns a tuple of the multiplication along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.overflowing_mul(PositiveInt::ZERO),
(PositiveInt::ZERO, false)
);
assert_eq!(
PositiveInt::ZERO.overflowing_mul(PositiveInt::MAX),
(PositiveInt::ZERO, false)
);
assert_eq!(
PositiveInt::MAX.overflowing_mul(PositiveInt::ZERO),
(PositiveInt::ZERO, false)
);
assert_eq!(
PositiveInt::MAX.overflowing_mul(PositiveInt::MAX),
(PositiveInt::ONE, true)
);
sourcepub const fn overflowing_div(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_div(self, rhs: Self) -> (Self, bool)
Calculates the divisor when self
is divided by rhs
.
Returns a tuple of the divisor along with a boolean indicating whether
an arithmetic overflow would occur. Note that for unsigned integers
overflow never occurs, so the second value is always false
.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ONE.overflowing_div(PositiveInt::MAX),
(PositiveInt::ZERO, false)
);
assert_eq!(
PositiveInt::MAX.overflowing_div(PositiveInt::MAX),
(PositiveInt::ONE, false)
);
sourcepub const fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool)
Calculates the quotient of Euclidean division self.div_euclid(rhs)
.
Returns a tuple of the divisor along with a boolean indicating whether
an arithmetic overflow would occur. Note that for unsigned integers
overflow never occurs, so the second value is always false
. Since,
for the positive integers, all common definitions of division are
equal, this is exactly equal to self.overflowing_div(rhs)
.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ONE.overflowing_div_euclid(PositiveInt::MAX),
(PositiveInt::ZERO, false)
);
assert_eq!(
PositiveInt::MAX.overflowing_div_euclid(PositiveInt::MAX),
(PositiveInt::ONE, false)
);
sourcepub const fn overflowing_rem(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_rem(self, rhs: Self) -> (Self, bool)
Calculates the remainder when self is divided by rhs
.
Returns a tuple of the remainder along with a boolean indicating whether
an arithmetic overflow would occur. Note that for unsigned integers
overflow never occurs, so the second value is always false
.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ONE.overflowing_rem(PositiveInt::MAX),
(PositiveInt::ONE, false)
);
assert_eq!(
PositiveInt::MAX.overflowing_rem(PositiveInt::MAX),
(PositiveInt::ZERO, false)
);
sourcepub const fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool)
pub const fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool)
Calculates the remainder self.rem_euclid(rhs)
as if by Euclidean
division.
Returns a tuple of the remainder along with a boolean indicating whether
an arithmetic overflow would occur. Note that for unsigned integers
overflow never occurs, so the second value is always false
. Since,
for the positive integers, all common definitions of division are
equal, this operation is exactly equal to self.overflowing_rem(rhs)
.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ONE.overflowing_rem_euclid(PositiveInt::MAX),
(PositiveInt::ONE, false)
);
assert_eq!(
PositiveInt::MAX.overflowing_rem_euclid(PositiveInt::MAX),
(PositiveInt::ZERO, false)
);
sourcepub const fn overflowing_neg(self) -> (Self, bool)
pub const fn overflowing_neg(self) -> (Self, bool)
Negates self
in an overflowing fashion.
Returns !self + PositiveInt::ONE
using wrapping operations to return
the value that represents the negation of this unsigned value. Note
that for positive unsigned values overflow always occurs, but negating
PositiveInt::ZERO
does not overflow.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.overflowing_neg(),
(PositiveInt::ZERO, false)
);
assert_eq!(
PositiveInt::ONE.overflowing_neg(),
(PositiveInt::MAX, true)
);
assert_eq!(
PositiveInt::MAX.overflowing_neg(),
(PositiveInt::ONE, true)
);
sourcepub const fn overflowing_shl(self, rhs: u32) -> (Self, bool)
pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool)
Shifts self
left by rhs
bits.
Returns a tuple of the shifted version of self
along with a boolean
indicating whether the shift value was larger than or equal to the
number of bits. If the shift value is too large, then it is wrapped
around through rhs % Self::EFFECTIVE_BITS
, and this value is then
used to perform the shift.
§Examples
Basic usage:
assert_eq!(
PositiveInt::MAX.overflowing_shl(PositiveInt::EFFECTIVE_BITS - 1),
(PositiveInt::MAX << (PositiveInt::EFFECTIVE_BITS - 1), false)
);
assert_eq!(
PositiveInt::MAX.overflowing_shl(PositiveInt::EFFECTIVE_BITS),
(PositiveInt::MAX, true)
);
assert_eq!(
PositiveInt::MAX.overflowing_shl(PositiveInt::EFFECTIVE_BITS + 1),
(PositiveInt::MAX << 1, true)
);
sourcepub const fn overflowing_shr(self, rhs: u32) -> (Self, bool)
pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool)
Shifts self
right by rhs
bits.
Returns a tuple of the shifted version of self
along with a boolean
indicating whether the shift value was larger than or equal to the
number of bits. If the shift value is too large, then it is wrapped
around through rhs % Self::EFFECTIVE_BITS
, and this value is then
used to perform the shift.
§Examples
Basic usage:
assert_eq!(
PositiveInt::MAX.overflowing_shr(PositiveInt::EFFECTIVE_BITS - 1),
(PositiveInt::MAX >> (PositiveInt::EFFECTIVE_BITS - 1), false)
);
assert_eq!(
PositiveInt::MAX.overflowing_shr(PositiveInt::EFFECTIVE_BITS),
(PositiveInt::MAX, true)
);
assert_eq!(
PositiveInt::MAX.overflowing_shr(PositiveInt::EFFECTIVE_BITS + 1),
(PositiveInt::MAX >> 1, true)
);
sourcepub const fn overflowing_pow(self, exp: u32) -> (Self, bool)
pub const fn overflowing_pow(self, exp: u32) -> (Self, bool)
Raises self
to the power of exp
, using exponentiation by squaring.
Returns a tuple of the exponentiation along with a bool
indicating
whether an overflow happened.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.overflowing_pow(0),
(PositiveInt::ONE, false)
);
assert_eq!(
PositiveInt::ONE.overflowing_pow(3),
(PositiveInt::ONE, false)
);
assert_eq!(
PositiveInt::MAX.overflowing_pow(1),
(PositiveInt::MAX, false)
);
assert_eq!(
PositiveInt::MAX.overflowing_pow(2),
(PositiveInt::ONE, true)
);
sourcepub const fn pow(self, exp: u32) -> Self
pub const fn pow(self, exp: u32) -> Self
Raises self
to the power of exp
, using exponentiation by squaring.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.pow(0),
PositiveInt::ONE
);
assert_eq!(
PositiveInt::ONE.pow(3),
PositiveInt::ONE
);
assert_eq!(
PositiveInt::MAX.pow(1),
PositiveInt::MAX
);
sourcepub const fn div_euclid(self, rhs: Self) -> Self
pub const fn div_euclid(self, rhs: Self) -> Self
Performs Euclidean division.
Since, for the positive integers, all common definitions of division are
equal, this is exactly equal to self / rhs
.
§Panics
This function will panic if rhs
is PositiveInt::ZERO
.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ONE.div_euclid(PositiveInt::MAX),
PositiveInt::ZERO
);
assert_eq!(
PositiveInt::MAX.div_euclid(PositiveInt::MAX),
PositiveInt::ONE
);
sourcepub const fn rem_euclid(self, rhs: Self) -> Self
pub const fn rem_euclid(self, rhs: Self) -> Self
Calculates the least remainder of self (mod rhs)
.
Since, for the positive integers, all common definitions of division are
equal, this is exactly equal to self % rhs
.
§Panics
This function will panic if rhs
is PositiveInt::ZERO
.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ONE.rem_euclid(PositiveInt::MAX),
PositiveInt::ONE
);
assert_eq!(
PositiveInt::MAX.rem_euclid(PositiveInt::MAX),
PositiveInt::ZERO
);
sourcepub const fn is_power_of_two(self) -> bool
pub const fn is_power_of_two(self) -> bool
Returns true
if and only if self == 2^k
for some k
.
§Examples
Basic usage:
assert!(!PositiveInt::ZERO.is_power_of_two());
assert!(PositiveInt::ONE.is_power_of_two());
assert!(!PositiveInt::MAX.is_power_of_two());
sourcepub const fn next_power_of_two(self) -> Self
pub const fn next_power_of_two(self) -> Self
Returns the smallest power of two greater than or equal to self
.
When return value overflows (i.e., self > (PositiveInt::ONE << (PositiveInt::EFFECTIVE_BITS - 1))
, it panics in debug mode and the
return value is wrapped to 0 in release mode (the only situation in
which method can return 0).
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.next_power_of_two(),
PositiveInt::ONE
);
assert_eq!(
PositiveInt::ONE.next_power_of_two(),
PositiveInt::ONE
);
sourcepub const fn checked_next_power_of_two(self) -> Option<Self>
pub const fn checked_next_power_of_two(self) -> Option<Self>
Returns the smallest power of two greater than or equal to self
. If
the next power of two is greater than the type’s maximum value, None
is returned, otherwise the power of two is wrapped in Some
.
§Examples
Basic usage:
assert_eq!(
PositiveInt::ZERO.checked_next_power_of_two(),
Some(PositiveInt::ONE)
);
assert_eq!(
PositiveInt::ONE.checked_next_power_of_two(),
Some(PositiveInt::ONE)
);
assert_eq!(
PositiveInt::MAX.checked_next_power_of_two(),
None
);
sourcepub fn iter_range(
start: Self,
end: Self
) -> impl DoubleEndedIterator<Item = Self> + Clone + ExactSizeIterator + FusedIterator
pub fn iter_range( start: Self, end: Self ) -> impl DoubleEndedIterator<Item = Self> + Clone + ExactSizeIterator + FusedIterator
sourcepub fn iter_range_inclusive(
start: Self,
end: Self
) -> impl DoubleEndedIterator<Item = Self> + Clone + ExactSizeIterator + FusedIterator
pub fn iter_range_inclusive( start: Self, end: Self ) -> impl DoubleEndedIterator<Item = Self> + Clone + ExactSizeIterator + FusedIterator
Construct a RangeInclusive
-like iterator of this integer type
This needs to exist for the same reason that iter_range()
does.
sourcepub fn iter_range_from(start: Self) -> impl FusedIterator<Item = Self> + Clone
pub fn iter_range_from(start: Self) -> impl FusedIterator<Item = Self> + Clone
Construct a RangeFrom
-like iterator of this integer type
This needs to exist for the same reason that iter_range()
does.
Trait Implementations§
source§impl Add<&PositiveInt> for &isize
impl Add<&PositiveInt> for &isize
§type Output = PositiveInt
type Output = PositiveInt
+
operator.source§fn add(self, rhs: &PositiveInt) -> PositiveInt
fn add(self, rhs: &PositiveInt) -> PositiveInt
+
operation. Read moresource§impl Add<&PositiveInt> for isize
impl Add<&PositiveInt> for isize
§type Output = PositiveInt
type Output = PositiveInt
+
operator.source§fn add(self, rhs: &PositiveInt) -> PositiveInt
fn add(self, rhs: &PositiveInt) -> PositiveInt
+
operation. Read moresource§impl Add<&isize> for &PositiveInt
impl Add<&isize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
+
operator.source§impl Add<&isize> for PositiveInt
impl Add<&isize> for PositiveInt
source§impl<B: Borrow<PositiveInt>> Add<B> for &PositiveInt
impl<B: Borrow<PositiveInt>> Add<B> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
+
operator.source§fn add(self, rhs: B) -> PositiveInt
fn add(self, rhs: B) -> PositiveInt
+
operation. Read moresource§impl<B: Borrow<Self>> Add<B> for PositiveInt
impl<B: Borrow<Self>> Add<B> for PositiveInt
source§impl Add<PositiveInt> for &isize
impl Add<PositiveInt> for &isize
§type Output = PositiveInt
type Output = PositiveInt
+
operator.source§fn add(self, rhs: PositiveInt) -> PositiveInt
fn add(self, rhs: PositiveInt) -> PositiveInt
+
operation. Read moresource§impl Add<PositiveInt> for isize
impl Add<PositiveInt> for isize
§type Output = PositiveInt
type Output = PositiveInt
+
operator.source§fn add(self, rhs: PositiveInt) -> PositiveInt
fn add(self, rhs: PositiveInt) -> PositiveInt
+
operation. Read moresource§impl Add<isize> for &PositiveInt
impl Add<isize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
+
operator.source§impl Add<isize> for PositiveInt
impl Add<isize> for PositiveInt
source§impl<Rhs> AddAssign<Rhs> for PositiveIntwhere
Self: Add<Rhs, Output = Self>,
impl<Rhs> AddAssign<Rhs> for PositiveIntwhere
Self: Add<Rhs, Output = Self>,
source§fn add_assign(&mut self, rhs: Rhs)
fn add_assign(&mut self, rhs: Rhs)
+=
operation. Read moresource§impl Arbitrary for PositiveInt
Available on crate feature proptest
only.
impl Arbitrary for PositiveInt
proptest
only.§type Parameters = ()
type Parameters = ()
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = Map<RangeInclusive<u32>, fn(_: u32) -> PositiveInt>
type Strategy = Map<RangeInclusive<u32>, fn(_: u32) -> PositiveInt>
Strategy
used to generate values of type Self
.source§fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy
source§impl Binary for PositiveInt
impl Binary for PositiveInt
source§impl BitAnd<&PositiveInt> for &usize
impl BitAnd<&PositiveInt> for &usize
§type Output = PositiveInt
type Output = PositiveInt
&
operator.source§fn bitand(self, rhs: &PositiveInt) -> PositiveInt
fn bitand(self, rhs: &PositiveInt) -> PositiveInt
&
operation. Read moresource§impl BitAnd<&PositiveInt> for usize
impl BitAnd<&PositiveInt> for usize
§type Output = PositiveInt
type Output = PositiveInt
&
operator.source§fn bitand(self, rhs: &PositiveInt) -> PositiveInt
fn bitand(self, rhs: &PositiveInt) -> PositiveInt
&
operation. Read moresource§impl BitAnd<&usize> for &PositiveInt
impl BitAnd<&usize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
&
operator.source§impl BitAnd<&usize> for PositiveInt
impl BitAnd<&usize> for PositiveInt
source§impl<B: Borrow<PositiveInt>> BitAnd<B> for &PositiveInt
impl<B: Borrow<PositiveInt>> BitAnd<B> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
&
operator.source§fn bitand(self, rhs: B) -> PositiveInt
fn bitand(self, rhs: B) -> PositiveInt
&
operation. Read moresource§impl<B: Borrow<Self>> BitAnd<B> for PositiveInt
impl<B: Borrow<Self>> BitAnd<B> for PositiveInt
source§impl BitAnd<PositiveInt> for &usize
impl BitAnd<PositiveInt> for &usize
§type Output = PositiveInt
type Output = PositiveInt
&
operator.source§fn bitand(self, rhs: PositiveInt) -> PositiveInt
fn bitand(self, rhs: PositiveInt) -> PositiveInt
&
operation. Read moresource§impl BitAnd<PositiveInt> for usize
impl BitAnd<PositiveInt> for usize
§type Output = PositiveInt
type Output = PositiveInt
&
operator.source§fn bitand(self, rhs: PositiveInt) -> PositiveInt
fn bitand(self, rhs: PositiveInt) -> PositiveInt
&
operation. Read moresource§impl BitAnd<usize> for &PositiveInt
impl BitAnd<usize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
&
operator.source§impl BitAnd<usize> for PositiveInt
impl BitAnd<usize> for PositiveInt
source§impl<Rhs> BitAndAssign<Rhs> for PositiveIntwhere
Self: BitAnd<Rhs, Output = Self>,
impl<Rhs> BitAndAssign<Rhs> for PositiveIntwhere
Self: BitAnd<Rhs, Output = Self>,
source§fn bitand_assign(&mut self, rhs: Rhs)
fn bitand_assign(&mut self, rhs: Rhs)
&=
operation. Read moresource§impl BitOr<&PositiveInt> for &usize
impl BitOr<&PositiveInt> for &usize
§type Output = PositiveInt
type Output = PositiveInt
|
operator.source§fn bitor(self, rhs: &PositiveInt) -> PositiveInt
fn bitor(self, rhs: &PositiveInt) -> PositiveInt
|
operation. Read moresource§impl BitOr<&PositiveInt> for usize
impl BitOr<&PositiveInt> for usize
§type Output = PositiveInt
type Output = PositiveInt
|
operator.source§fn bitor(self, rhs: &PositiveInt) -> PositiveInt
fn bitor(self, rhs: &PositiveInt) -> PositiveInt
|
operation. Read moresource§impl BitOr<&usize> for &PositiveInt
impl BitOr<&usize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
|
operator.source§impl BitOr<&usize> for PositiveInt
impl BitOr<&usize> for PositiveInt
source§impl<B: Borrow<PositiveInt>> BitOr<B> for &PositiveInt
impl<B: Borrow<PositiveInt>> BitOr<B> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
|
operator.source§fn bitor(self, rhs: B) -> PositiveInt
fn bitor(self, rhs: B) -> PositiveInt
|
operation. Read moresource§impl<B: Borrow<Self>> BitOr<B> for PositiveInt
impl<B: Borrow<Self>> BitOr<B> for PositiveInt
source§impl BitOr<PositiveInt> for &usize
impl BitOr<PositiveInt> for &usize
§type Output = PositiveInt
type Output = PositiveInt
|
operator.source§fn bitor(self, rhs: PositiveInt) -> PositiveInt
fn bitor(self, rhs: PositiveInt) -> PositiveInt
|
operation. Read moresource§impl BitOr<PositiveInt> for usize
impl BitOr<PositiveInt> for usize
§type Output = PositiveInt
type Output = PositiveInt
|
operator.source§fn bitor(self, rhs: PositiveInt) -> PositiveInt
fn bitor(self, rhs: PositiveInt) -> PositiveInt
|
operation. Read moresource§impl BitOr<usize> for &PositiveInt
impl BitOr<usize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
|
operator.source§impl BitOr<usize> for PositiveInt
impl BitOr<usize> for PositiveInt
source§impl<Rhs> BitOrAssign<Rhs> for PositiveIntwhere
Self: BitOr<Rhs, Output = Self>,
impl<Rhs> BitOrAssign<Rhs> for PositiveIntwhere
Self: BitOr<Rhs, Output = Self>,
source§fn bitor_assign(&mut self, rhs: Rhs)
fn bitor_assign(&mut self, rhs: Rhs)
|=
operation. Read moresource§impl BitXor<&PositiveInt> for &usize
impl BitXor<&PositiveInt> for &usize
§type Output = PositiveInt
type Output = PositiveInt
^
operator.source§fn bitxor(self, rhs: &PositiveInt) -> PositiveInt
fn bitxor(self, rhs: &PositiveInt) -> PositiveInt
^
operation. Read moresource§impl BitXor<&PositiveInt> for usize
impl BitXor<&PositiveInt> for usize
§type Output = PositiveInt
type Output = PositiveInt
^
operator.source§fn bitxor(self, rhs: &PositiveInt) -> PositiveInt
fn bitxor(self, rhs: &PositiveInt) -> PositiveInt
^
operation. Read moresource§impl BitXor<&usize> for &PositiveInt
impl BitXor<&usize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
^
operator.source§impl BitXor<&usize> for PositiveInt
impl BitXor<&usize> for PositiveInt
source§impl<B: Borrow<PositiveInt>> BitXor<B> for &PositiveInt
impl<B: Borrow<PositiveInt>> BitXor<B> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
^
operator.source§fn bitxor(self, rhs: B) -> PositiveInt
fn bitxor(self, rhs: B) -> PositiveInt
^
operation. Read moresource§impl<B: Borrow<Self>> BitXor<B> for PositiveInt
impl<B: Borrow<Self>> BitXor<B> for PositiveInt
source§impl BitXor<PositiveInt> for &usize
impl BitXor<PositiveInt> for &usize
§type Output = PositiveInt
type Output = PositiveInt
^
operator.source§fn bitxor(self, rhs: PositiveInt) -> PositiveInt
fn bitxor(self, rhs: PositiveInt) -> PositiveInt
^
operation. Read moresource§impl BitXor<PositiveInt> for usize
impl BitXor<PositiveInt> for usize
§type Output = PositiveInt
type Output = PositiveInt
^
operator.source§fn bitxor(self, rhs: PositiveInt) -> PositiveInt
fn bitxor(self, rhs: PositiveInt) -> PositiveInt
^
operation. Read moresource§impl BitXor<usize> for &PositiveInt
impl BitXor<usize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
^
operator.source§impl BitXor<usize> for PositiveInt
impl BitXor<usize> for PositiveInt
source§impl<Rhs> BitXorAssign<Rhs> for PositiveIntwhere
Self: BitXor<Rhs, Output = Self>,
impl<Rhs> BitXorAssign<Rhs> for PositiveIntwhere
Self: BitXor<Rhs, Output = Self>,
source§fn bitxor_assign(&mut self, rhs: Rhs)
fn bitxor_assign(&mut self, rhs: Rhs)
^=
operation. Read moresource§impl Clone for PositiveInt
impl Clone for PositiveInt
source§fn clone(&self) -> PositiveInt
fn clone(&self) -> PositiveInt
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PositiveInt
impl Debug for PositiveInt
source§impl Default for PositiveInt
impl Default for PositiveInt
source§fn default() -> PositiveInt
fn default() -> PositiveInt
source§impl Display for PositiveInt
impl Display for PositiveInt
source§impl Div<&usize> for &PositiveInt
impl Div<&usize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
/
operator.source§impl Div<&usize> for PositiveInt
impl Div<&usize> for PositiveInt
source§impl<B: Borrow<PositiveInt>> Div<B> for &PositiveInt
impl<B: Borrow<PositiveInt>> Div<B> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
/
operator.source§fn div(self, rhs: B) -> PositiveInt
fn div(self, rhs: B) -> PositiveInt
/
operation. Read moresource§impl<B: Borrow<Self>> Div<B> for PositiveInt
impl<B: Borrow<Self>> Div<B> for PositiveInt
source§impl Div<usize> for &PositiveInt
impl Div<usize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
/
operator.source§impl Div<usize> for PositiveInt
impl Div<usize> for PositiveInt
source§impl<Rhs> DivAssign<Rhs> for PositiveIntwhere
Self: Div<Rhs, Output = Self>,
impl<Rhs> DivAssign<Rhs> for PositiveIntwhere
Self: Div<Rhs, Output = Self>,
source§fn div_assign(&mut self, rhs: Rhs)
fn div_assign(&mut self, rhs: Rhs)
/=
operation. Read moresource§impl From<PositiveInt> for Depth
impl From<PositiveInt> for Depth
source§fn from(value: NormalDepth) -> Self
fn from(value: NormalDepth) -> Self
source§impl From<PositiveInt> for isize
impl From<PositiveInt> for isize
source§fn from(x: PositiveInt) -> Self
fn from(x: PositiveInt) -> Self
source§impl From<PositiveInt> for usize
impl From<PositiveInt> for usize
source§fn from(x: PositiveInt) -> Self
fn from(x: PositiveInt) -> Self
source§impl FromStr for PositiveInt
impl FromStr for PositiveInt
§type Err = ParseIntError
type Err = ParseIntError
source§impl Hash for PositiveInt
impl Hash for PositiveInt
source§impl LowerExp for PositiveInt
impl LowerExp for PositiveInt
source§impl LowerHex for PositiveInt
impl LowerHex for PositiveInt
source§impl Mul<&PositiveInt> for &usize
impl Mul<&PositiveInt> for &usize
§type Output = PositiveInt
type Output = PositiveInt
*
operator.source§fn mul(self, rhs: &PositiveInt) -> PositiveInt
fn mul(self, rhs: &PositiveInt) -> PositiveInt
*
operation. Read moresource§impl Mul<&PositiveInt> for usize
impl Mul<&PositiveInt> for usize
§type Output = PositiveInt
type Output = PositiveInt
*
operator.source§fn mul(self, rhs: &PositiveInt) -> PositiveInt
fn mul(self, rhs: &PositiveInt) -> PositiveInt
*
operation. Read moresource§impl Mul<&usize> for &PositiveInt
impl Mul<&usize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
*
operator.source§impl Mul<&usize> for PositiveInt
impl Mul<&usize> for PositiveInt
source§impl<B: Borrow<PositiveInt>> Mul<B> for &PositiveInt
impl<B: Borrow<PositiveInt>> Mul<B> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
*
operator.source§fn mul(self, rhs: B) -> PositiveInt
fn mul(self, rhs: B) -> PositiveInt
*
operation. Read moresource§impl<B: Borrow<Self>> Mul<B> for PositiveInt
impl<B: Borrow<Self>> Mul<B> for PositiveInt
source§impl Mul<PositiveInt> for &usize
impl Mul<PositiveInt> for &usize
§type Output = PositiveInt
type Output = PositiveInt
*
operator.source§fn mul(self, rhs: PositiveInt) -> PositiveInt
fn mul(self, rhs: PositiveInt) -> PositiveInt
*
operation. Read moresource§impl Mul<PositiveInt> for usize
impl Mul<PositiveInt> for usize
§type Output = PositiveInt
type Output = PositiveInt
*
operator.source§fn mul(self, rhs: PositiveInt) -> PositiveInt
fn mul(self, rhs: PositiveInt) -> PositiveInt
*
operation. Read moresource§impl Mul<usize> for &PositiveInt
impl Mul<usize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
*
operator.source§impl Mul<usize> for PositiveInt
impl Mul<usize> for PositiveInt
source§impl<Rhs> MulAssign<Rhs> for PositiveIntwhere
Self: Mul<Rhs, Output = Self>,
impl<Rhs> MulAssign<Rhs> for PositiveIntwhere
Self: Mul<Rhs, Output = Self>,
source§fn mul_assign(&mut self, rhs: Rhs)
fn mul_assign(&mut self, rhs: Rhs)
*=
operation. Read moresource§impl Not for &PositiveInt
impl Not for &PositiveInt
source§impl Not for PositiveInt
impl Not for PositiveInt
source§impl Octal for PositiveInt
impl Octal for PositiveInt
source§impl Ord for PositiveInt
impl Ord for PositiveInt
source§fn cmp(&self, other: &PositiveInt) -> Ordering
fn cmp(&self, other: &PositiveInt) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<PositiveInt> for Depth
impl PartialEq<PositiveInt> for Depth
source§fn eq(&self, other: &NormalDepth) -> bool
fn eq(&self, other: &NormalDepth) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<PositiveInt> for usize
impl PartialEq<PositiveInt> for usize
source§fn eq(&self, other: &PositiveInt) -> bool
fn eq(&self, other: &PositiveInt) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<usize> for PositiveInt
impl PartialEq<usize> for PositiveInt
source§impl PartialEq for PositiveInt
impl PartialEq for PositiveInt
source§fn eq(&self, other: &PositiveInt) -> bool
fn eq(&self, other: &PositiveInt) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<PositiveInt> for usize
impl PartialOrd<PositiveInt> for usize
source§fn partial_cmp(&self, other: &PositiveInt) -> Option<Ordering>
fn partial_cmp(&self, other: &PositiveInt) -> 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 PartialOrd<usize> for PositiveInt
impl PartialOrd<usize> for PositiveInt
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 PartialOrd for PositiveInt
impl PartialOrd for PositiveInt
source§fn partial_cmp(&self, other: &PositiveInt) -> Option<Ordering>
fn partial_cmp(&self, other: &PositiveInt) -> 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<B: Borrow<Self>> Product<B> for PositiveInt
impl<B: Borrow<Self>> Product<B> for PositiveInt
source§impl Rem<&usize> for &PositiveInt
impl Rem<&usize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
%
operator.source§impl Rem<&usize> for PositiveInt
impl Rem<&usize> for PositiveInt
source§impl<B: Borrow<PositiveInt>> Rem<B> for &PositiveInt
impl<B: Borrow<PositiveInt>> Rem<B> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
%
operator.source§fn rem(self, rhs: B) -> PositiveInt
fn rem(self, rhs: B) -> PositiveInt
%
operation. Read moresource§impl<B: Borrow<Self>> Rem<B> for PositiveInt
impl<B: Borrow<Self>> Rem<B> for PositiveInt
source§impl Rem<usize> for &PositiveInt
impl Rem<usize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
%
operator.source§impl Rem<usize> for PositiveInt
impl Rem<usize> for PositiveInt
source§impl<Rhs> RemAssign<Rhs> for PositiveIntwhere
Self: Rem<Rhs, Output = Self>,
impl<Rhs> RemAssign<Rhs> for PositiveIntwhere
Self: Rem<Rhs, Output = Self>,
source§fn rem_assign(&mut self, rhs: Rhs)
fn rem_assign(&mut self, rhs: Rhs)
%=
operation. Read moresource§impl Shl<&PositiveInt> for &PositiveInt
impl Shl<&PositiveInt> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§fn shl(self, rhs: &PositiveInt) -> PositiveInt
fn shl(self, rhs: &PositiveInt) -> PositiveInt
<<
operation. Read moresource§impl Shl<&PositiveInt> for PositiveInt
impl Shl<&PositiveInt> for PositiveInt
source§impl Shl<&i128> for &PositiveInt
impl Shl<&i128> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<&i128> for PositiveInt
impl Shl<&i128> for PositiveInt
source§impl Shl<&i16> for &PositiveInt
impl Shl<&i16> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<&i16> for PositiveInt
impl Shl<&i16> for PositiveInt
source§impl Shl<&i32> for &PositiveInt
impl Shl<&i32> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<&i32> for PositiveInt
impl Shl<&i32> for PositiveInt
source§impl Shl<&i64> for &PositiveInt
impl Shl<&i64> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<&i64> for PositiveInt
impl Shl<&i64> for PositiveInt
source§impl Shl<&i8> for &PositiveInt
impl Shl<&i8> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<&i8> for PositiveInt
impl Shl<&i8> for PositiveInt
source§impl Shl<&isize> for &PositiveInt
impl Shl<&isize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<&isize> for PositiveInt
impl Shl<&isize> for PositiveInt
source§impl Shl<&u128> for &PositiveInt
impl Shl<&u128> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<&u128> for PositiveInt
impl Shl<&u128> for PositiveInt
source§impl Shl<&u16> for &PositiveInt
impl Shl<&u16> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<&u16> for PositiveInt
impl Shl<&u16> for PositiveInt
source§impl Shl<&u32> for &PositiveInt
impl Shl<&u32> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<&u32> for PositiveInt
impl Shl<&u32> for PositiveInt
source§impl Shl<&u64> for &PositiveInt
impl Shl<&u64> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<&u64> for PositiveInt
impl Shl<&u64> for PositiveInt
source§impl Shl<&u8> for &PositiveInt
impl Shl<&u8> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<&u8> for PositiveInt
impl Shl<&u8> for PositiveInt
source§impl Shl<&usize> for &PositiveInt
impl Shl<&usize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<&usize> for PositiveInt
impl Shl<&usize> for PositiveInt
source§impl Shl<PositiveInt> for &PositiveInt
impl Shl<PositiveInt> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§fn shl(self, rhs: PositiveInt) -> PositiveInt
fn shl(self, rhs: PositiveInt) -> PositiveInt
<<
operation. Read moresource§impl Shl<i128> for &PositiveInt
impl Shl<i128> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<i128> for PositiveInt
impl Shl<i128> for PositiveInt
source§impl Shl<i16> for &PositiveInt
impl Shl<i16> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<i16> for PositiveInt
impl Shl<i16> for PositiveInt
source§impl Shl<i32> for &PositiveInt
impl Shl<i32> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<i32> for PositiveInt
impl Shl<i32> for PositiveInt
source§impl Shl<i64> for &PositiveInt
impl Shl<i64> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<i64> for PositiveInt
impl Shl<i64> for PositiveInt
source§impl Shl<i8> for &PositiveInt
impl Shl<i8> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<i8> for PositiveInt
impl Shl<i8> for PositiveInt
source§impl Shl<isize> for &PositiveInt
impl Shl<isize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<isize> for PositiveInt
impl Shl<isize> for PositiveInt
source§impl Shl<u128> for &PositiveInt
impl Shl<u128> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<u128> for PositiveInt
impl Shl<u128> for PositiveInt
source§impl Shl<u16> for &PositiveInt
impl Shl<u16> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<u16> for PositiveInt
impl Shl<u16> for PositiveInt
source§impl Shl<u32> for &PositiveInt
impl Shl<u32> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<u32> for PositiveInt
impl Shl<u32> for PositiveInt
source§impl Shl<u64> for &PositiveInt
impl Shl<u64> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<u64> for PositiveInt
impl Shl<u64> for PositiveInt
source§impl Shl<u8> for &PositiveInt
impl Shl<u8> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<u8> for PositiveInt
impl Shl<u8> for PositiveInt
source§impl Shl<usize> for &PositiveInt
impl Shl<usize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
<<
operator.source§impl Shl<usize> for PositiveInt
impl Shl<usize> for PositiveInt
source§impl Shl for PositiveInt
impl Shl for PositiveInt
source§impl<Rhs> ShlAssign<Rhs> for PositiveIntwhere
Self: Shl<Rhs, Output = Self>,
impl<Rhs> ShlAssign<Rhs> for PositiveIntwhere
Self: Shl<Rhs, Output = Self>,
source§fn shl_assign(&mut self, rhs: Rhs)
fn shl_assign(&mut self, rhs: Rhs)
<<=
operation. Read moresource§impl Shr<&PositiveInt> for &PositiveInt
impl Shr<&PositiveInt> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§fn shr(self, rhs: &PositiveInt) -> PositiveInt
fn shr(self, rhs: &PositiveInt) -> PositiveInt
>>
operation. Read moresource§impl Shr<&PositiveInt> for PositiveInt
impl Shr<&PositiveInt> for PositiveInt
source§impl Shr<&i128> for &PositiveInt
impl Shr<&i128> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<&i128> for PositiveInt
impl Shr<&i128> for PositiveInt
source§impl Shr<&i16> for &PositiveInt
impl Shr<&i16> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<&i16> for PositiveInt
impl Shr<&i16> for PositiveInt
source§impl Shr<&i32> for &PositiveInt
impl Shr<&i32> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<&i32> for PositiveInt
impl Shr<&i32> for PositiveInt
source§impl Shr<&i64> for &PositiveInt
impl Shr<&i64> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<&i64> for PositiveInt
impl Shr<&i64> for PositiveInt
source§impl Shr<&i8> for &PositiveInt
impl Shr<&i8> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<&i8> for PositiveInt
impl Shr<&i8> for PositiveInt
source§impl Shr<&isize> for &PositiveInt
impl Shr<&isize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<&isize> for PositiveInt
impl Shr<&isize> for PositiveInt
source§impl Shr<&u128> for &PositiveInt
impl Shr<&u128> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<&u128> for PositiveInt
impl Shr<&u128> for PositiveInt
source§impl Shr<&u16> for &PositiveInt
impl Shr<&u16> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<&u16> for PositiveInt
impl Shr<&u16> for PositiveInt
source§impl Shr<&u32> for &PositiveInt
impl Shr<&u32> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<&u32> for PositiveInt
impl Shr<&u32> for PositiveInt
source§impl Shr<&u64> for &PositiveInt
impl Shr<&u64> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<&u64> for PositiveInt
impl Shr<&u64> for PositiveInt
source§impl Shr<&u8> for &PositiveInt
impl Shr<&u8> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<&u8> for PositiveInt
impl Shr<&u8> for PositiveInt
source§impl Shr<&usize> for &PositiveInt
impl Shr<&usize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<&usize> for PositiveInt
impl Shr<&usize> for PositiveInt
source§impl Shr<PositiveInt> for &PositiveInt
impl Shr<PositiveInt> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§fn shr(self, rhs: PositiveInt) -> PositiveInt
fn shr(self, rhs: PositiveInt) -> PositiveInt
>>
operation. Read moresource§impl Shr<i128> for &PositiveInt
impl Shr<i128> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<i128> for PositiveInt
impl Shr<i128> for PositiveInt
source§impl Shr<i16> for &PositiveInt
impl Shr<i16> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<i16> for PositiveInt
impl Shr<i16> for PositiveInt
source§impl Shr<i32> for &PositiveInt
impl Shr<i32> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<i32> for PositiveInt
impl Shr<i32> for PositiveInt
source§impl Shr<i64> for &PositiveInt
impl Shr<i64> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<i64> for PositiveInt
impl Shr<i64> for PositiveInt
source§impl Shr<i8> for &PositiveInt
impl Shr<i8> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<i8> for PositiveInt
impl Shr<i8> for PositiveInt
source§impl Shr<isize> for &PositiveInt
impl Shr<isize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<isize> for PositiveInt
impl Shr<isize> for PositiveInt
source§impl Shr<u128> for &PositiveInt
impl Shr<u128> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<u128> for PositiveInt
impl Shr<u128> for PositiveInt
source§impl Shr<u16> for &PositiveInt
impl Shr<u16> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<u16> for PositiveInt
impl Shr<u16> for PositiveInt
source§impl Shr<u32> for &PositiveInt
impl Shr<u32> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<u32> for PositiveInt
impl Shr<u32> for PositiveInt
source§impl Shr<u64> for &PositiveInt
impl Shr<u64> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<u64> for PositiveInt
impl Shr<u64> for PositiveInt
source§impl Shr<u8> for &PositiveInt
impl Shr<u8> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<u8> for PositiveInt
impl Shr<u8> for PositiveInt
source§impl Shr<usize> for &PositiveInt
impl Shr<usize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
>>
operator.source§impl Shr<usize> for PositiveInt
impl Shr<usize> for PositiveInt
source§impl Shr for PositiveInt
impl Shr for PositiveInt
source§impl<Rhs> ShrAssign<Rhs> for PositiveIntwhere
Self: Shr<Rhs, Output = Self>,
impl<Rhs> ShrAssign<Rhs> for PositiveIntwhere
Self: Shr<Rhs, Output = Self>,
source§fn shr_assign(&mut self, rhs: Rhs)
fn shr_assign(&mut self, rhs: Rhs)
>>=
operation. Read moresource§impl Sub<&isize> for &PositiveInt
impl Sub<&isize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
-
operator.source§impl Sub<&isize> for PositiveInt
impl Sub<&isize> for PositiveInt
source§impl<B: Borrow<PositiveInt>> Sub<B> for &PositiveInt
impl<B: Borrow<PositiveInt>> Sub<B> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
-
operator.source§fn sub(self, rhs: B) -> PositiveInt
fn sub(self, rhs: B) -> PositiveInt
-
operation. Read moresource§impl<B: Borrow<Self>> Sub<B> for PositiveInt
impl<B: Borrow<Self>> Sub<B> for PositiveInt
source§impl Sub<isize> for &PositiveInt
impl Sub<isize> for &PositiveInt
§type Output = PositiveInt
type Output = PositiveInt
-
operator.source§impl Sub<isize> for PositiveInt
impl Sub<isize> for PositiveInt
source§impl<Rhs> SubAssign<Rhs> for PositiveIntwhere
Self: Sub<Rhs, Output = Self>,
impl<Rhs> SubAssign<Rhs> for PositiveIntwhere
Self: Sub<Rhs, Output = Self>,
source§fn sub_assign(&mut self, rhs: Rhs)
fn sub_assign(&mut self, rhs: Rhs)
-=
operation. Read more