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

source

pub const MIN: Self = _

The smallest value of this integer type

source

pub const ZERO: Self = _

The zero of this integer type

source

pub const ONE: Self = _

The 1 of this integer type

source

pub const MAX: Self = _

The largest value of this integer type

source

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.

source

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));
source

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);
source

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);
source

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);
source

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);
source

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);
source

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);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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)
);
source

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
);
source

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)
);
source

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)
);
source

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)
);
source

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)
);
source

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
);
source

pub const fn ilog2(self) -> u32

Returns the base 2 logarithm of the number, rounded down.

§Panics

This function will panic if self is zero.

§Examples
assert_eq!(
    PositiveInt::ONE.ilog2(),
    0
);
assert_eq!(
    PositiveInt::MAX.ilog2(),
    PositiveInt::EFFECTIVE_BITS - 1
);
source

pub const fn ilog10(self) -> u32

Returns the base 10 logarithm of the number, rounded down.

§Panics

This function will panic if self is zero.

§Examples
assert_eq!(
    PositiveInt::ONE.ilog10(),
    0
);
assert_eq!(
    PositiveInt::try_from(100).unwrap().ilog10(),
    2
);
source

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)
);
source

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)
);
source

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)
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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
);
source

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)
);
source

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)
);
source

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)
);
source

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
);
source

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)
);
source

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)
);
source

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)
);
source

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)
);
source

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)
);
source

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)
);
source

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)
);
source

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)
);
source

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)
);
source

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
);
source

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
);
source

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
);
source

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());
source

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
);
source

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
);
source

pub fn iter_range( start: Self, end: Self ) -> impl DoubleEndedIterator<Item = Self> + Clone + ExactSizeIterator + FusedIterator

Construct a Range-like iterator of this integer type

Unfortunately, Range<PositiveInt> does not implement Iterator due to that impl’s dependency on the rustc-private Step trait. This method is the workaround.

source

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.

source

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

§

type Output = PositiveInt

The resulting type after applying the + operator.
source§

fn add(self, rhs: &PositiveInt) -> PositiveInt

Performs the + operation. Read more
source§

impl Add<&PositiveInt> for isize

§

type Output = PositiveInt

The resulting type after applying the + operator.
source§

fn add(self, rhs: &PositiveInt) -> PositiveInt

Performs the + operation. Read more
source§

impl Add<&isize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the + operator.
source§

fn add(self, rhs: &isize) -> PositiveInt

Performs the + operation. Read more
source§

impl Add<&isize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl<B: Borrow<PositiveInt>> Add<B> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the + operator.
source§

fn add(self, rhs: B) -> PositiveInt

Performs the + operation. Read more
source§

impl<B: Borrow<Self>> Add<B> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<PositiveInt> for &isize

§

type Output = PositiveInt

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<PositiveInt> for isize

§

type Output = PositiveInt

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Add<isize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the + operator.
source§

fn add(self, rhs: isize) -> PositiveInt

Performs the + operation. Read more
source§

impl Add<isize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl<Rhs> AddAssign<Rhs> for PositiveInt
where Self: Add<Rhs, Output = Self>,

source§

fn add_assign(&mut self, rhs: Rhs)

Performs the += operation. Read more
source§

impl Arbitrary for PositiveInt

Available on crate feature proptest only.
§

type Parameters = ()

The type of parameters that arbitrary_with accepts for configuration of the generated Strategy. Parameters must implement Default.
§

type Strategy = Map<RangeInclusive<u32>, fn(_: u32) -> PositiveInt>

The type of Strategy used to generate values of type Self.
source§

fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). The strategy is passed the arguments given in args. Read more
source§

fn arbitrary() -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). Read more
source§

impl Binary for PositiveInt

source§

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

Formats the value using the given formatter.
source§

impl BitAnd<&PositiveInt> for &usize

§

type Output = PositiveInt

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &PositiveInt) -> PositiveInt

Performs the & operation. Read more
source§

impl BitAnd<&PositiveInt> for usize

§

type Output = PositiveInt

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &PositiveInt) -> PositiveInt

Performs the & operation. Read more
source§

impl BitAnd<&usize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &usize) -> PositiveInt

Performs the & operation. Read more
source§

impl BitAnd<&usize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &usize) -> Self

Performs the & operation. Read more
source§

impl<B: Borrow<PositiveInt>> BitAnd<B> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: B) -> PositiveInt

Performs the & operation. Read more
source§

impl<B: Borrow<Self>> BitAnd<B> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: B) -> Self

Performs the & operation. Read more
source§

impl BitAnd<PositiveInt> for &usize

§

type Output = PositiveInt

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: PositiveInt) -> PositiveInt

Performs the & operation. Read more
source§

impl BitAnd<PositiveInt> for usize

§

type Output = PositiveInt

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: PositiveInt) -> PositiveInt

Performs the & operation. Read more
source§

impl BitAnd<usize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: usize) -> PositiveInt

Performs the & operation. Read more
source§

impl BitAnd<usize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: usize) -> Self

Performs the & operation. Read more
source§

impl<Rhs> BitAndAssign<Rhs> for PositiveInt
where Self: BitAnd<Rhs, Output = Self>,

source§

fn bitand_assign(&mut self, rhs: Rhs)

Performs the &= operation. Read more
source§

impl BitOr<&PositiveInt> for &usize

§

type Output = PositiveInt

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &PositiveInt) -> PositiveInt

Performs the | operation. Read more
source§

impl BitOr<&PositiveInt> for usize

§

type Output = PositiveInt

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &PositiveInt) -> PositiveInt

Performs the | operation. Read more
source§

impl BitOr<&usize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &usize) -> PositiveInt

Performs the | operation. Read more
source§

impl BitOr<&usize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &usize) -> Self

Performs the | operation. Read more
source§

impl<B: Borrow<PositiveInt>> BitOr<B> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: B) -> PositiveInt

Performs the | operation. Read more
source§

impl<B: Borrow<Self>> BitOr<B> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: B) -> Self

Performs the | operation. Read more
source§

impl BitOr<PositiveInt> for &usize

§

type Output = PositiveInt

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: PositiveInt) -> PositiveInt

Performs the | operation. Read more
source§

impl BitOr<PositiveInt> for usize

§

type Output = PositiveInt

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: PositiveInt) -> PositiveInt

Performs the | operation. Read more
source§

impl BitOr<usize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: usize) -> PositiveInt

Performs the | operation. Read more
source§

impl BitOr<usize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: usize) -> Self

Performs the | operation. Read more
source§

impl<Rhs> BitOrAssign<Rhs> for PositiveInt
where Self: BitOr<Rhs, Output = Self>,

source§

fn bitor_assign(&mut self, rhs: Rhs)

Performs the |= operation. Read more
source§

impl BitXor<&PositiveInt> for &usize

§

type Output = PositiveInt

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &PositiveInt) -> PositiveInt

Performs the ^ operation. Read more
source§

impl BitXor<&PositiveInt> for usize

§

type Output = PositiveInt

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &PositiveInt) -> PositiveInt

Performs the ^ operation. Read more
source§

impl BitXor<&usize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &usize) -> PositiveInt

Performs the ^ operation. Read more
source§

impl BitXor<&usize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &usize) -> Self

Performs the ^ operation. Read more
source§

impl<B: Borrow<PositiveInt>> BitXor<B> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: B) -> PositiveInt

Performs the ^ operation. Read more
source§

impl<B: Borrow<Self>> BitXor<B> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: B) -> Self

Performs the ^ operation. Read more
source§

impl BitXor<PositiveInt> for &usize

§

type Output = PositiveInt

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: PositiveInt) -> PositiveInt

Performs the ^ operation. Read more
source§

impl BitXor<PositiveInt> for usize

§

type Output = PositiveInt

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: PositiveInt) -> PositiveInt

Performs the ^ operation. Read more
source§

impl BitXor<usize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: usize) -> PositiveInt

Performs the ^ operation. Read more
source§

impl BitXor<usize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: usize) -> Self

Performs the ^ operation. Read more
source§

impl<Rhs> BitXorAssign<Rhs> for PositiveInt
where Self: BitXor<Rhs, Output = Self>,

source§

fn bitxor_assign(&mut self, rhs: Rhs)

Performs the ^= operation. Read more
source§

impl Clone for PositiveInt

source§

fn clone(&self) -> PositiveInt

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for PositiveInt

source§

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

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

impl Default for PositiveInt

source§

fn default() -> PositiveInt

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

impl Display for PositiveInt

source§

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

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

impl Div<&usize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the / operator.
source§

fn div(self, rhs: &usize) -> PositiveInt

Performs the / operation. Read more
source§

impl Div<&usize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl<B: Borrow<PositiveInt>> Div<B> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the / operator.
source§

fn div(self, rhs: B) -> PositiveInt

Performs the / operation. Read more
source§

impl<B: Borrow<Self>> Div<B> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl Div<usize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the / operator.
source§

fn div(self, rhs: usize) -> PositiveInt

Performs the / operation. Read more
source§

impl Div<usize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl<Rhs> DivAssign<Rhs> for PositiveInt
where Self: Div<Rhs, Output = Self>,

source§

fn div_assign(&mut self, rhs: Rhs)

Performs the /= operation. Read more
source§

impl From<PositiveInt> for Depth

source§

fn from(value: NormalDepth) -> Self

Converts to this type from the input type.
source§

impl From<PositiveInt> for isize

source§

fn from(x: PositiveInt) -> Self

Converts to this type from the input type.
source§

impl From<PositiveInt> for usize

source§

fn from(x: PositiveInt) -> Self

Converts to this type from the input type.
source§

impl FromStr for PositiveInt

§

type Err = ParseIntError

The associated error which can be returned from parsing.
source§

fn from_str(src: &str) -> Result<Self, ParseIntError>

Parses a string s to return a value of this type. Read more
source§

impl Hash for PositiveInt

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

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

impl LowerExp for PositiveInt

source§

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

Formats the value using the given formatter.
source§

impl LowerHex for PositiveInt

source§

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

Formats the value using the given formatter.
source§

impl Mul<&PositiveInt> for &usize

§

type Output = PositiveInt

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &PositiveInt) -> PositiveInt

Performs the * operation. Read more
source§

impl Mul<&PositiveInt> for usize

§

type Output = PositiveInt

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &PositiveInt) -> PositiveInt

Performs the * operation. Read more
source§

impl Mul<&usize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &usize) -> PositiveInt

Performs the * operation. Read more
source§

impl Mul<&usize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &usize) -> Self

Performs the * operation. Read more
source§

impl<B: Borrow<PositiveInt>> Mul<B> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the * operator.
source§

fn mul(self, rhs: B) -> PositiveInt

Performs the * operation. Read more
source§

impl<B: Borrow<Self>> Mul<B> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the * operator.
source§

fn mul(self, rhs: B) -> Self

Performs the * operation. Read more
source§

impl Mul<PositiveInt> for &usize

§

type Output = PositiveInt

The resulting type after applying the * operator.
source§

fn mul(self, rhs: PositiveInt) -> PositiveInt

Performs the * operation. Read more
source§

impl Mul<PositiveInt> for usize

§

type Output = PositiveInt

The resulting type after applying the * operator.
source§

fn mul(self, rhs: PositiveInt) -> PositiveInt

Performs the * operation. Read more
source§

impl Mul<usize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the * operator.
source§

fn mul(self, rhs: usize) -> PositiveInt

Performs the * operation. Read more
source§

impl Mul<usize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the * operator.
source§

fn mul(self, rhs: usize) -> Self

Performs the * operation. Read more
source§

impl<Rhs> MulAssign<Rhs> for PositiveInt
where Self: Mul<Rhs, Output = Self>,

source§

fn mul_assign(&mut self, rhs: Rhs)

Performs the *= operation. Read more
source§

impl Not for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl Not for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl Octal for PositiveInt

source§

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

Formats the value using the given formatter.
source§

impl Ord for PositiveInt

source§

fn cmp(&self, other: &PositiveInt) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<PositiveInt> for Depth

source§

fn eq(&self, other: &NormalDepth) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

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

impl PartialEq<PositiveInt> for usize

source§

fn eq(&self, other: &PositiveInt) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

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

impl PartialEq<usize> for PositiveInt

source§

fn eq(&self, other: &usize) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

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

impl PartialEq for PositiveInt

source§

fn eq(&self, other: &PositiveInt) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

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

impl PartialOrd<PositiveInt> for usize

source§

fn partial_cmp(&self, other: &PositiveInt) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

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

fn le(&self, other: &Rhs) -> bool

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

fn gt(&self, other: &Rhs) -> bool

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

fn ge(&self, other: &Rhs) -> bool

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

impl PartialOrd<usize> for PositiveInt

source§

fn partial_cmp(&self, other: &usize) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

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

fn le(&self, other: &Rhs) -> bool

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

fn gt(&self, other: &Rhs) -> bool

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

fn ge(&self, other: &Rhs) -> bool

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

impl PartialOrd for PositiveInt

source§

fn partial_cmp(&self, other: &PositiveInt) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

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

fn le(&self, other: &Rhs) -> bool

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

fn gt(&self, other: &Rhs) -> bool

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

fn ge(&self, other: &Rhs) -> bool

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

impl<B: Borrow<Self>> Product<B> for PositiveInt

source§

fn product<I: Iterator<Item = B>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl Rem<&usize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the % operator.
source§

fn rem(self, rhs: &usize) -> PositiveInt

Performs the % operation. Read more
source§

impl Rem<&usize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the % operator.
source§

fn rem(self, rhs: &usize) -> Self

Performs the % operation. Read more
source§

impl<B: Borrow<PositiveInt>> Rem<B> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the % operator.
source§

fn rem(self, rhs: B) -> PositiveInt

Performs the % operation. Read more
source§

impl<B: Borrow<Self>> Rem<B> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the % operator.
source§

fn rem(self, rhs: B) -> Self

Performs the % operation. Read more
source§

impl Rem<usize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the % operator.
source§

fn rem(self, rhs: usize) -> PositiveInt

Performs the % operation. Read more
source§

impl Rem<usize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the % operator.
source§

fn rem(self, rhs: usize) -> Self

Performs the % operation. Read more
source§

impl<Rhs> RemAssign<Rhs> for PositiveInt
where Self: Rem<Rhs, Output = Self>,

source§

fn rem_assign(&mut self, rhs: Rhs)

Performs the %= operation. Read more
source§

impl Shl<&PositiveInt> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &PositiveInt) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<&PositiveInt> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &Self) -> Self

Performs the << operation. Read more
source§

impl Shl<&i128> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &i128) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<&i128> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &i128) -> Self

Performs the << operation. Read more
source§

impl Shl<&i16> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &i16) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<&i16> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &i16) -> Self

Performs the << operation. Read more
source§

impl Shl<&i32> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &i32) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<&i32> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &i32) -> Self

Performs the << operation. Read more
source§

impl Shl<&i64> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &i64) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<&i64> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &i64) -> Self

Performs the << operation. Read more
source§

impl Shl<&i8> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &i8) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<&i8> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &i8) -> Self

Performs the << operation. Read more
source§

impl Shl<&isize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &isize) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<&isize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &isize) -> Self

Performs the << operation. Read more
source§

impl Shl<&u128> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &u128) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<&u128> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &u128) -> Self

Performs the << operation. Read more
source§

impl Shl<&u16> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &u16) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<&u16> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &u16) -> Self

Performs the << operation. Read more
source§

impl Shl<&u32> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &u32) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<&u32> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &u32) -> Self

Performs the << operation. Read more
source§

impl Shl<&u64> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &u64) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<&u64> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &u64) -> Self

Performs the << operation. Read more
source§

impl Shl<&u8> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &u8) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<&u8> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &u8) -> Self

Performs the << operation. Read more
source§

impl Shl<&usize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &usize) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<&usize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &usize) -> Self

Performs the << operation. Read more
source§

impl Shl<PositiveInt> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: PositiveInt) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<i128> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: i128) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<i128> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: i128) -> Self

Performs the << operation. Read more
source§

impl Shl<i16> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: i16) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<i16> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: i16) -> Self

Performs the << operation. Read more
source§

impl Shl<i32> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: i32) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<i32> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: i32) -> Self

Performs the << operation. Read more
source§

impl Shl<i64> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: i64) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<i64> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: i64) -> Self

Performs the << operation. Read more
source§

impl Shl<i8> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: i8) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<i8> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: i8) -> Self

Performs the << operation. Read more
source§

impl Shl<isize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: isize) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<isize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: isize) -> Self

Performs the << operation. Read more
source§

impl Shl<u128> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: u128) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<u128> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: u128) -> Self

Performs the << operation. Read more
source§

impl Shl<u16> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: u16) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<u16> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: u16) -> Self

Performs the << operation. Read more
source§

impl Shl<u32> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: u32) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<u32> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: u32) -> Self

Performs the << operation. Read more
source§

impl Shl<u64> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: u64) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<u64> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: u64) -> Self

Performs the << operation. Read more
source§

impl Shl<u8> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: u8) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<u8> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: u8) -> Self

Performs the << operation. Read more
source§

impl Shl<usize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: usize) -> PositiveInt

Performs the << operation. Read more
source§

impl Shl<usize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

fn shl(self, rhs: usize) -> Self

Performs the << operation. Read more
source§

impl Shl for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the << operator.
source§

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

Performs the << operation. Read more
source§

impl<Rhs> ShlAssign<Rhs> for PositiveInt
where Self: Shl<Rhs, Output = Self>,

source§

fn shl_assign(&mut self, rhs: Rhs)

Performs the <<= operation. Read more
source§

impl Shr<&PositiveInt> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &PositiveInt) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<&PositiveInt> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &Self) -> Self

Performs the >> operation. Read more
source§

impl Shr<&i128> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &i128) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<&i128> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &i128) -> Self

Performs the >> operation. Read more
source§

impl Shr<&i16> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &i16) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<&i16> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &i16) -> Self

Performs the >> operation. Read more
source§

impl Shr<&i32> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &i32) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<&i32> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &i32) -> Self

Performs the >> operation. Read more
source§

impl Shr<&i64> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &i64) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<&i64> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &i64) -> Self

Performs the >> operation. Read more
source§

impl Shr<&i8> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &i8) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<&i8> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &i8) -> Self

Performs the >> operation. Read more
source§

impl Shr<&isize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &isize) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<&isize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &isize) -> Self

Performs the >> operation. Read more
source§

impl Shr<&u128> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &u128) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<&u128> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &u128) -> Self

Performs the >> operation. Read more
source§

impl Shr<&u16> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &u16) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<&u16> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &u16) -> Self

Performs the >> operation. Read more
source§

impl Shr<&u32> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &u32) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<&u32> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &u32) -> Self

Performs the >> operation. Read more
source§

impl Shr<&u64> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &u64) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<&u64> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &u64) -> Self

Performs the >> operation. Read more
source§

impl Shr<&u8> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &u8) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<&u8> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &u8) -> Self

Performs the >> operation. Read more
source§

impl Shr<&usize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &usize) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<&usize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &usize) -> Self

Performs the >> operation. Read more
source§

impl Shr<PositiveInt> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: PositiveInt) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<i128> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: i128) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<i128> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: i128) -> Self

Performs the >> operation. Read more
source§

impl Shr<i16> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: i16) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<i16> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: i16) -> Self

Performs the >> operation. Read more
source§

impl Shr<i32> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: i32) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<i32> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: i32) -> Self

Performs the >> operation. Read more
source§

impl Shr<i64> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: i64) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<i64> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: i64) -> Self

Performs the >> operation. Read more
source§

impl Shr<i8> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: i8) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<i8> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: i8) -> Self

Performs the >> operation. Read more
source§

impl Shr<isize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: isize) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<isize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: isize) -> Self

Performs the >> operation. Read more
source§

impl Shr<u128> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: u128) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<u128> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: u128) -> Self

Performs the >> operation. Read more
source§

impl Shr<u16> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: u16) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<u16> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: u16) -> Self

Performs the >> operation. Read more
source§

impl Shr<u32> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: u32) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<u32> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: u32) -> Self

Performs the >> operation. Read more
source§

impl Shr<u64> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: u64) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<u64> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: u64) -> Self

Performs the >> operation. Read more
source§

impl Shr<u8> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: u8) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<u8> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: u8) -> Self

Performs the >> operation. Read more
source§

impl Shr<usize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: usize) -> PositiveInt

Performs the >> operation. Read more
source§

impl Shr<usize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: usize) -> Self

Performs the >> operation. Read more
source§

impl Shr for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the >> operator.
source§

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

Performs the >> operation. Read more
source§

impl<Rhs> ShrAssign<Rhs> for PositiveInt
where Self: Shr<Rhs, Output = Self>,

source§

fn shr_assign(&mut self, rhs: Rhs)

Performs the >>= operation. Read more
source§

impl Sub<&isize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &isize) -> PositiveInt

Performs the - operation. Read more
source§

impl Sub<&isize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &isize) -> Self

Performs the - operation. Read more
source§

impl<B: Borrow<PositiveInt>> Sub<B> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the - operator.
source§

fn sub(self, rhs: B) -> PositiveInt

Performs the - operation. Read more
source§

impl<B: Borrow<Self>> Sub<B> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the - operator.
source§

fn sub(self, rhs: B) -> Self

Performs the - operation. Read more
source§

impl Sub<isize> for &PositiveInt

§

type Output = PositiveInt

The resulting type after applying the - operator.
source§

fn sub(self, rhs: isize) -> PositiveInt

Performs the - operation. Read more
source§

impl Sub<isize> for PositiveInt

§

type Output = PositiveInt

The resulting type after applying the - operator.
source§

fn sub(self, rhs: isize) -> Self

Performs the - operation. Read more
source§

impl<Rhs> SubAssign<Rhs> for PositiveInt
where Self: Sub<Rhs, Output = Self>,

source§

fn sub_assign(&mut self, rhs: Rhs)

Performs the -= operation. Read more
source§

impl<B: Borrow<Self>> Sum<B> for PositiveInt

source§

fn sum<I: Iterator<Item = B>>(iter: I) -> Self

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

impl TryFrom<PositiveInt> for i128

§

type Error = TryFromIntError

The type returned in the event of a conversion error.
source§

fn try_from(value: PositiveInt) -> Result<Self, TryFromIntError>

Performs the conversion.
source§

impl TryFrom<PositiveInt> for i16

§

type Error = TryFromIntError

The type returned in the event of a conversion error.
source§

fn try_from(value: PositiveInt) -> Result<Self, TryFromIntError>

Performs the conversion.
source§

impl TryFrom<PositiveInt> for i32

§

type Error = TryFromIntError

The type returned in the event of a conversion error.
source§

fn try_from(value: PositiveInt) -> Result<Self, TryFromIntError>

Performs the conversion.
source§

impl TryFrom<PositiveInt> for i64

§

type Error = TryFromIntError

The type returned in the event of a conversion error.
source§

fn try_from(value: PositiveInt) -> Result<Self, TryFromIntError>

Performs the conversion.
source§

impl TryFrom<PositiveInt> for i8

§

type Error = TryFromIntError

The type returned in the event of a conversion error.
source§

fn try_from(value: PositiveInt) -> Result<Self, TryFromIntError>

Performs the conversion.
source§

impl TryFrom<PositiveInt> for u128

§

type Error = TryFromIntError

The type returned in the event of a conversion error.
source§

fn try_from(value: PositiveInt) -> Result<Self, TryFromIntError>

Performs the conversion.
source§

impl TryFrom<PositiveInt> for u16

§

type Error = TryFromIntError

The type returned in the event of a conversion error.
source§

fn try_from(value: PositiveInt) -> Result<Self, TryFromIntError>

Performs the conversion.
source§

impl TryFrom<PositiveInt> for u32

§

type Error = TryFromIntError

The type returned in the event of a conversion error.
source§

fn try_from(value: PositiveInt) -> Result<Self, TryFromIntError>

Performs the conversion.
source§

impl TryFrom<PositiveInt> for u64

§

type Error = TryFromIntError

The type returned in the event of a conversion error.
source§

fn try_from(value: PositiveInt) -> Result<Self, TryFromIntError>

Performs the conversion.
source§

impl TryFrom<PositiveInt> for u8

§

type Error = TryFromIntError

The type returned in the event of a conversion error.
source§

fn try_from(value: PositiveInt) -> Result<Self, TryFromIntError>

Performs the conversion.
source§

impl TryFrom<usize> for PositiveInt

§

type Error = TryFromIntError

The type returned in the event of a conversion error.
source§

fn try_from(value: usize) -> Result<Self, TryFromIntError>

Performs the conversion.
source§

impl UpperExp for PositiveInt

source§

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

Formats the value using the given formatter.
source§

impl UpperHex for PositiveInt

source§

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

Formats the value using the given formatter.
source§

impl Copy for PositiveInt

source§

impl Eq for PositiveInt

source§

impl StructuralPartialEq for PositiveInt

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V