Struct extprim::u128::u128
[−]
[src]
#[repr(C)]pub struct u128 { /* fields omitted */ }
An unsigned 128-bit number.
Methods
impl u128
[src]
const fn new(lo: u64) -> u128
[src]
Constructs a new 128-bit integer from a 64-bit integer.
const fn from_built_in(value: u128) -> u128
[src]
Constructs a new 128-bit integer from the built-in 128-bit integer.
const fn from_parts(hi: u64, lo: u64) -> u128
[src]
Constructs a new 128-bit integer from the high-64-bit and low-64-bit parts.
The new integer can be considered as hi * 2**64 + lo
.
Examples
use extprim::u128::u128; let number = u128::from_parts(6692605942, 14083847773837265618); assert_eq!(format!("{}", number), "123456789012345678901234567890");
fn low64(self) -> u64
[src]
Fetches the lower-64-bit of the number.
Examples
use extprim::u128::u128; let number = u128::from_str_radix("ffd1390a0adc2fb8dabbb8174d95c99b", 16).unwrap(); assert_eq!(number.low64(), 0xdabbb8174d95c99b);
fn high64(self) -> u64
[src]
Fetch the higher-64-bit of the number.
Examples
use extprim::u128::u128; let number = u128::from_str_radix("ffd1390a0adc2fb8dabbb8174d95c99b", 16).unwrap(); assert_eq!(number.high64(), 0xffd1390a0adc2fb8);
fn as_i128(self) -> i128
[src]
Converts this number to signed with wrapping.
Examples
use extprim::u128::u128; use extprim::i128::i128; let a = u128::from_str_radix( "ffd1390a0adc2fb8dabbb8174d95c99b", 16).unwrap(); let b = i128::from_str_radix("-002ec6f5f523d047254447e8b26a3665", 16).unwrap(); assert_eq!(a.as_i128(), b); assert_eq!(b.as_u128(), a);
fn as_built_in(self) -> u128
[src]
Converts this number to the built-in 128-bit integer type.
impl u128
[src]
fn wrapping_add(self, other: u128) -> u128
[src]
Wrapping (modular) addition. Computes self + other
, wrapping around at the boundary of
the type.
Examples
use extprim::u128::u128; assert_eq!(u128::new(5).wrapping_add(u128::new(6)), u128::new(11)); assert_eq!(u128::max_value().wrapping_add(u128::one()), u128::zero());
fn wrapping_sub(self, other: u128) -> u128
[src]
Wrapping (modular) subtraction. Computes self - other
, wrapping around at the boundary of
the type.
Examples
use extprim::u128::u128; assert_eq!(u128::new(6).wrapping_sub(u128::new(5)), u128::one()); assert_eq!(u128::new(5).wrapping_sub(u128::new(6)), u128::max_value());
fn overflowing_add(self, other: u128) -> (u128, bool)
[src]
Calculates self + other
.
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
use extprim::u128::u128; assert_eq!(u128::new(6).overflowing_add(u128::new(13)), (u128::new(19), false)); assert_eq!(u128::max_value().overflowing_add(u128::one()), (u128::zero(), true));
fn overflowing_sub(self, other: u128) -> (u128, bool)
[src]
Calculates self - other
.
Returns a tuple of the subtraction along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.
Examples
use extprim::u128::u128; assert_eq!(u128::new(6).overflowing_sub(u128::new(5)), (u128::one(), false)); assert_eq!(u128::new(5).overflowing_sub(u128::new(6)), (u128::max_value(), true));
fn saturating_add(self, other: u128) -> u128
[src]
Saturating integer addition. Computes self + other
, saturating at the numeric bounds
instead of overflowing.
Examples
use extprim::u128::u128; assert_eq!(u128::new(13).saturating_add(u128::new(7)), u128::new(20)); let huge_num = u128::from_str_radix("ccccccccbbbbbbbbaaaaaaaa99999999", 16).unwrap(); let also_big = u128::from_str_radix("5566778899aabbccddeeff0011223344", 16).unwrap(); assert_eq!(huge_num.saturating_add(also_big), u128::max_value());
fn saturating_sub(self, other: u128) -> u128
[src]
Saturating integer subtraction. Computes self - other
, saturating at the numeric bounds
instead of overflowing.
Examples
use extprim::u128::u128; assert_eq!(u128::new(91).saturating_sub(u128::new(13)), u128::new(78)); assert_eq!(u128::new(13).saturating_sub(u128::new(91)), u128::zero());
fn wrapping_neg(self) -> u128
[src]
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)
.
Examples
use extprim::u128::u128; assert_eq!(u128::zero().wrapping_neg(), u128::zero()); assert_eq!(u128::one().wrapping_neg(), u128::max_value()); assert_eq!(u128::max_value().wrapping_neg(), u128::one());
impl u128
[src]
fn checked_add(self, other: u128) -> Option<u128>
[src]
Checked integer addition. Computes self + other
, returning None
if overflow occurred.
Examples
use extprim::u128::u128; assert_eq!(u128::new(5).checked_add(u128::new(8)), Some(u128::new(13))); assert_eq!(u128::max_value().checked_add(u128::max_value()), None);
impl u128
[src]
fn checked_sub(self, other: u128) -> Option<u128>
[src]
Checked integer subtraction. Computes self - other
, returning None
if underflow
occurred.
Examples
use extprim::u128::u128; assert_eq!(u128::new(8).checked_sub(u128::new(5)), Some(u128::new(3))); assert_eq!(u128::new(5).checked_sub(u128::new(8)), None);
impl u128
[src]
fn wrapping_shl(self, shift: u32) -> u128
[src]
Panic-free bitwise shift-left; yields self << (shift % 128)
.
Examples
use extprim::u128::u128; assert_eq!(u128::new(7).wrapping_shl(66), u128::from_parts(28, 0)); assert_eq!(u128::new(7).wrapping_shl(128), u128::new(7)); assert_eq!(u128::new(7).wrapping_shl(129), u128::new(14));
fn wrapping_shr(self, shift: u32) -> u128
[src]
Panic-free bitwsie shift-right; yields self >> (shift % 128)
.
Examples
use extprim::u128::u128; assert_eq!(u128::max_value().wrapping_shr(66), u128::new(0x3fffffffffffffff)); assert_eq!(u128::new(7).wrapping_shr(128), u128::new(7)); assert_eq!(u128::new(7).wrapping_shr(129), u128::new(3));
fn overflowing_shl(self, other: u32) -> (u128, bool)
[src]
Shifts self
left by other
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 (128). If the shift value is
too large, then value is masked by 0x7f
, and this value is then used to perform the shift.
Examples
use extprim::u128::u128; assert_eq!(u128::new(7).overflowing_shl(66), (u128::from_parts(28, 0), false)); assert_eq!(u128::new(7).overflowing_shl(128), (u128::new(7), true)); assert_eq!(u128::new(7).overflowing_shl(129), (u128::new(14), true));
fn overflowing_shr(self, other: u32) -> (u128, bool)
[src]
Shifts self
right by other
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 (128). If the shift value is
too large, then value is masked by 0x7f
, and this value is then used to perform the shift.
Examples
use extprim::u128::u128; assert_eq!(u128::max_value().overflowing_shr(66), (u128::new(0x3fffffffffffffff), false)); assert_eq!(u128::new(7).overflowing_shr(128), (u128::new(7), true)); assert_eq!(u128::new(7).overflowing_shr(129), (u128::new(3), true));
impl u128
[src]
fn checked_shl(self, other: u32) -> Option<u128>
[src]
Checked shift left. Computes self << other
, returning None
if the shift is larger than
or equal to the number of bits in self
(128).
Examples
use extprim::u128::u128; assert_eq!(u128::new(7).checked_shl(66), Some(u128::from_parts(28, 0))); assert_eq!(u128::new(7).checked_shl(128), None); assert_eq!(u128::new(7).checked_shl(129), None);
impl u128
[src]
fn checked_shr(self, other: u32) -> Option<u128>
[src]
Checked shift right. Computes self >> other
, returning None
if the shift is larger than
or equal to the number of bits in self
(128).
Examples
use extprim::u128::u128; assert_eq!(u128::max_value().checked_shr(66), Some(u128::new(0x3fffffffffffffff))); assert_eq!(u128::new(7).checked_shr(128), None); assert_eq!(u128::new(7).checked_shr(129), None);
impl u128
[src]
fn wrapping_mul(self, other: u128) -> u128
[src]
Wrapping (modular) multiplication. Computes self * other
, wrapping around at the boundary
of the type.
Examples
use extprim::u128::u128; assert_eq!(u128::new(6).wrapping_mul(u128::new(9)), u128::new(54)); let a = u128::max_value() - u128::new(2); let b = u128::max_value() - u128::new(4); assert_eq!(a.wrapping_mul(b), u128::new(15));
fn overflowing_mul(self, other: u128) -> (u128, bool)
[src]
Calculates the multiplication of self
and other
.
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
use extprim::u128::u128; assert_eq!(u128::new(6).overflowing_mul(u128::new(9)), (u128::new(54), false)); let a = u128::max_value() - u128::new(2); let b = u128::max_value() - u128::new(4); assert_eq!(a.overflowing_mul(b), (u128::new(15), true));
fn saturating_mul(self, other: u128) -> u128
[src]
Saturating integer multiplication. Computes self * other
, saturating at the numeric
bounds instead of overflowing.
Examples
use extprim::u128::u128; assert_eq!(u128::new(6).saturating_mul(u128::new(9)), u128::new(54)); let a = u128::max_value() - u128::new(2); let b = u128::max_value() - u128::new(4); assert_eq!(a.saturating_mul(b), u128::max_value());
fn wrapping_mul_64(self, other: u64) -> u128
[src]
Wrapping (modular) multiplication with a 64-bit number. Computes self * other
, wrapping
around at the boundary of the type.
Examples
use extprim::u128::u128; assert_eq!(u128::new(6).wrapping_mul_64(9), u128::new(54)); let a = u128::max_value() - u128::new(2); assert_eq!(a.wrapping_mul_64(7), u128::max_value() - u128::new(20));
fn overflowing_mul_64(self, other: u64) -> (u128, bool)
[src]
Calculates the multiplication of self
and other
with a 64-bit number.
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
use extprim::u128::u128; assert_eq!(u128::new(6).overflowing_mul_64(9), (u128::new(54), false)); let a = u128::max_value() - u128::new(2); assert_eq!(a.overflowing_mul_64(7), (u128::max_value() - u128::new(20), true));
fn saturating_mul_64(self, other: u64) -> u128
[src]
Saturating integer multiplication with a 64-bit number. Computes self * other
, saturating
at the numeric bounds instead of overflowing.
Examples
use extprim::u128::u128; assert_eq!(u128::new(6).saturating_mul_64(9), u128::new(54)); let a = u128::max_value() - u128::new(2); assert_eq!(a.saturating_mul_64(7), u128::max_value());
impl u128
[src]
fn checked_mul(self, other: u128) -> Option<u128>
[src]
Checked integer multiplication. Computes self * other
, returning None
if underflow or
overflow occurred.
Examples
use extprim::u128::u128; assert_eq!(u128::new(6).checked_mul(u128::new(9)), Some(u128::new(54))); let a = u128::max_value() - u128::new(2); let b = u128::max_value() - u128::new(4); assert_eq!(a.checked_mul(b), None);
impl u128
[src]
fn checked_mul_64(self, other: u64) -> Option<u128>
[src]
Checked integer multiplication with a 64-bit number. Computes self * other
, returning
None
if underflow or overflow occurred.
Examples
use extprim::u128::u128; assert_eq!(u128::new(6).checked_mul_64(9), Some(u128::new(54))); let a = u128::max_value() - u128::new(2); assert_eq!(a.checked_mul_64(7), None);
impl u128
[src]
fn wrapping_div(self, other: u128) -> u128
[src]
Wrapping (modular) division. Computes self / other
. 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.
Panics
This function will panic if other
is 0.
Examples
use extprim::u128::u128; assert_eq!(u128::new(100).wrapping_div(u128::new(8)), u128::new(12));
fn wrapping_rem(self, other: u128) -> u128
[src]
Wrapping (modular) remainder. Computes self % other
. 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.
Panics
This function will panic if other
is 0.
Examples
use extprim::u128::u128; assert_eq!(u128::new(100).wrapping_rem(u128::new(8)), u128::new(4));
fn overflowing_div(self, other: u128) -> (u128, bool)
[src]
Calculates the divisor when self
is divided by other
.
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
.
Panics
This function will panic if other
is 0.
Examples
use extprim::u128::u128; assert_eq!(u128::new(100).overflowing_div(u128::new(8)), (u128::new(12), false));
fn overflowing_rem(self, other: u128) -> (u128, bool)
[src]
Calculates the remainder when self
is divided by other
.
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
.
Panics
This function will panic if other
is 0.
Examples
use extprim::u128::u128; assert_eq!(u128::new(100).overflowing_rem(u128::new(8)), (u128::new(4), false));
fn checked_div(self, other: u128) -> Option<u128>
[src]
Checked integer division. Computes self / other
, returning None
if other == 0
.
Examples
use extprim::u128::u128; assert_eq!(u128::new(100).checked_div(u128::new(8)), Some(u128::new(12))); assert_eq!(u128::new(100).checked_div(u128::zero()), None);
fn checked_rem(self, other: u128) -> Option<u128>
[src]
Checked integer remainder. Computes self % other
, returning None
if other == 0
.
Examples
use extprim::u128::u128; assert_eq!(u128::new(100).checked_rem(u128::new(8)), Some(u128::new(4))); assert_eq!(u128::new(100).checked_rem(u128::zero()), None);
impl u128
[src]
fn min_value() -> u128
[src]
Returns the smallest unsigned 128-bit integer (0).
fn max_value() -> u128
[src]
Returns the largest unsigned 128-bit integer
(340_282_366_920_938_463_463_374_607_431_768_211_455
).
fn zero() -> u128
[src]
Returns the constant 0.
fn one() -> u128
[src]
Returns the constant 1.
impl u128
[src]
fn count_ones(self) -> u32
[src]
Returns the number of ones in the binary representation of self
.
Examples
use extprim::u128::u128; let n = u128::from_str_radix("6f32f1ef8b18a2bc3cea59789c79d441", 16).unwrap(); assert_eq!(n.count_ones(), 67);
fn count_zeros(self) -> u32
[src]
Returns the number of zeros in the binary representation of self
(including leading zeros).
Examples
use extprim::u128::u128; let n = u128::from_str_radix("6f32f1ef8b18a2bc3cea59789c79d441", 16).unwrap(); assert_eq!(n.count_zeros(), 61);
fn leading_zeros(self) -> u32
[src]
Returns the number of leading zeros in the binary representation of self
.
Examples
use extprim::u128::u128; assert_eq!(u128::zero().leading_zeros(), 128); assert_eq!(u128::one().leading_zeros(), 127); assert_eq!(u128::max_value().leading_zeros(), 0); assert_eq!((u128::one() << 24u32).leading_zeros(), 103); assert_eq!((u128::one() << 124u32).leading_zeros(), 3);
fn trailing_zeros(self) -> u32
[src]
Returns the number of trailing zeros in the binary representation of self
.
Examples
use extprim::u128::u128; assert_eq!(u128::zero().trailing_zeros(), 128); assert_eq!(u128::one().trailing_zeros(), 0); assert_eq!((u128::one() << 24u32).trailing_zeros(), 24); assert_eq!((u128::one() << 124u32).trailing_zeros(), 124);
fn rotate_left(self, shift: u32) -> Self
[src]
Shifts the bits to the left by a specified amount, shift
, wrapping the truncated bits to
the end of the resulting integer.
Examples
use extprim::u128::u128; let a = u128::from_str_radix("d0cf4b50cfe20765fff4b4e3f741cf6d", 16).unwrap(); let b = u128::from_str_radix("19e96a19fc40ecbffe969c7ee839edba", 16).unwrap(); assert_eq!(a.rotate_left(5), b);
fn rotate_right(self, shift: u32) -> Self
[src]
Shifts the bits to the right by a specified amount, shift
, wrapping the truncated bits to
the beginning of the resulting integer.
Examples
use extprim::u128::u128; let a = u128::from_str_radix("d0cf4b50cfe20765fff4b4e3f741cf6d", 16).unwrap(); let b = u128::from_str_radix("6e867a5a867f103b2fffa5a71fba0e7b", 16).unwrap(); assert_eq!(a.rotate_right(5), b);
fn swap_bytes(self) -> Self
[src]
Reverses the byte order of the integer.
Examples
use extprim::u128::u128; let a = u128::from_str_radix("0123456789abcdef1112223334445556", 16).unwrap(); let b = u128::from_str_radix("5655443433221211efcdab8967452301", 16).unwrap(); assert_eq!(a.swap_bytes(), b);
fn from_be(x: Self) -> Self
[src]
Converts an integer from big endian to the target's endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
fn from_le(x: Self) -> Self
[src]
Converts an integer from little endian to the target's endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
fn to_be(self) -> Self
[src]
Converts self
to big endian from the target's endianness.
On big endian this is a no-op. On little endian the bytes are swapped.
fn to_le(self) -> Self
[src]
Converts self to little endian from the target's endianness.
On little endian this is a no-op. On big endian the bytes are swapped.
fn pow(self, exp: u32) -> Self
[src]
Raises self
to the power of exp
, using exponentiation by squaring.
Examples
use extprim::u128::u128; use std::str::FromStr; assert_eq!(u128::new(5).pow(30), u128::from_str("931322574615478515625").unwrap());
fn is_power_of_two(self) -> bool
[src]
Returns true
if and only if self == 2**k
for some k
.
Examples
use extprim::u128::u128; assert!(!u128::new(0).is_power_of_two()); assert!( u128::new(1).is_power_of_two()); assert!( u128::new(2).is_power_of_two()); assert!(!u128::new(3).is_power_of_two());
fn next_power_of_two(self) -> Self
[src]
Returns the smallest power of two greater than or equal to self
. Unspecified behavior on
overflow.
Examples
use extprim::u128::u128; assert_eq!(u128::zero().next_power_of_two(), u128::new(1)); assert_eq!(u128::one().next_power_of_two(), u128::new(1)); assert_eq!(u128::new(384).next_power_of_two(), u128::new(512)); assert_eq!(u128::new(0x80000000_00000001).next_power_of_two(), u128::from_parts(1, 0)); assert_eq!(u128::from_parts(0x80000000_00000000, 0).next_power_of_two(), u128::from_parts(0x80000000_00000000, 0));
fn checked_next_power_of_two(self) -> Option<Self>
[src]
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
use extprim::u128::u128; assert_eq!(u128::zero().checked_next_power_of_two(), Some(u128::new(1))); assert_eq!(u128::one().checked_next_power_of_two(), Some(u128::new(1))); assert_eq!(u128::new(384).checked_next_power_of_two(), Some(u128::new(512))); assert_eq!(u128::new(0x80000000_00000001).checked_next_power_of_two(), Some(u128::from_parts(1, 0))); assert_eq!(u128::from_parts(0x80000000_00000000, 0).checked_next_power_of_two(), Some(u128::from_parts(0x80000000_00000000, 0))); assert_eq!(u128::from_parts(0x80000000_00000000, 1).checked_next_power_of_two(), None); assert_eq!(u128::max_value().checked_next_power_of_two(), None);
impl u128
[src]
fn from_str_radix(src: &str, radix: u32) -> Result<u128, ParseIntError>
[src]
Converts a string slice in a given base to an integer.
Leading and trailing whitespace represent an error.
Arguments
- src: A string slice
- radix: The base to use. Must lie in the range [2 ... 36].
Return value
Err(ParseIntError)
if the string did not represent a valid number. Otherwise, Ok(n)
where n
is the integer represented by src
.
Trait Implementations
impl NumCast for u128
[src]
fn from<T: ToPrimitive>(n: T) -> Option<u128>
[src]
Creates a number from another value that can be converted into a primitive via the ToPrimitive
trait. Read more
impl Default for u128
[src]
impl Copy for u128
[src]
impl Clone for u128
[src]
fn clone(&self) -> u128
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Hash for u128
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialEq for u128
[src]
fn eq(&self, __arg_0: &u128) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &u128) -> bool
[src]
This method tests for !=
.
impl Eq for u128
[src]
impl Rand for u128
[src]
fn rand<R: Rng>(rng: &mut R) -> u128
[src]
Generates a random instance of this type using the specified source of randomness. Read more
impl Add<u128> for u128
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: u128) -> Self
[src]
Performs the +
operation.
impl Sub<u128> for u128
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, other: u128) -> Self
[src]
Performs the -
operation.
impl AddAssign<u128> for u128
[src]
fn add_assign(&mut self, other: u128)
[src]
Performs the +=
operation.
impl SubAssign<u128> for u128
[src]
fn sub_assign(&mut self, other: u128)
[src]
Performs the -=
operation.
impl CheckedAdd for u128
[src]
fn checked_add(&self, other: &Self) -> Option<Self>
[src]
Adds two numbers, checking for overflow. If overflow happens, None
is returned. Read more
impl CheckedSub for u128
[src]
fn checked_sub(&self, other: &Self) -> Option<Self>
[src]
Subtracts two numbers, checking for underflow. If underflow happens, None
is returned. Read more
impl Saturating for u128
[src]
fn saturating_add(self, other: Self) -> Self
[src]
Saturating addition operator. Returns a+b, saturating at the numeric bounds instead of overflowing. Read more
fn saturating_sub(self, other: Self) -> Self
[src]
Saturating subtraction operator. Returns a-b, saturating at the numeric bounds instead of overflowing. Read more
impl PartialOrd for u128
[src]
fn partial_cmp(&self, other: &u128) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for u128
[src]
fn cmp(&self, other: &u128) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.22.0[src]
Compares and returns the minimum of two values. Read more
impl Not for u128
[src]
type Output = Self
The resulting type after applying the !
operator.
fn not(self) -> Self
[src]
Performs the unary !
operation.
impl BitAnd for u128
[src]
type Output = Self
The resulting type after applying the &
operator.
fn bitand(self, other: Self) -> Self
[src]
Performs the &
operation.
impl BitOr for u128
[src]
type Output = Self
The resulting type after applying the |
operator.
fn bitor(self, other: Self) -> Self
[src]
Performs the |
operation.
impl BitXor for u128
[src]
type Output = Self
The resulting type after applying the ^
operator.
fn bitxor(self, other: Self) -> Self
[src]
Performs the ^
operation.
impl BitAndAssign<u128> for u128
[src]
fn bitand_assign(&mut self, other: u128)
[src]
Performs the &=
operation.
impl BitOrAssign<u128> for u128
[src]
fn bitor_assign(&mut self, other: u128)
[src]
Performs the |=
operation.
impl BitXorAssign<u128> for u128
[src]
fn bitxor_assign(&mut self, other: u128)
[src]
Performs the ^=
operation.
impl Shl<u8> for u128
[src]
type Output = Self
The resulting type after applying the <<
operator.
fn shl(self, other: u8) -> Self
[src]
Performs the <<
operation.
impl Shl<u16> for u128
[src]
type Output = Self
The resulting type after applying the <<
operator.
fn shl(self, other: u16) -> Self
[src]
Performs the <<
operation.
impl Shl<u32> for u128
[src]
type Output = Self
The resulting type after applying the <<
operator.
fn shl(self, other: u32) -> Self
[src]
Performs the <<
operation.
impl Shl<u64> for u128
[src]
type Output = Self
The resulting type after applying the <<
operator.
fn shl(self, other: u64) -> Self
[src]
Performs the <<
operation.
impl Shl<usize> for u128
[src]
type Output = Self
The resulting type after applying the <<
operator.
fn shl(self, other: usize) -> Self
[src]
Performs the <<
operation.
impl Shl<i8> for u128
[src]
type Output = Self
The resulting type after applying the <<
operator.
fn shl(self, other: i8) -> Self
[src]
Performs the <<
operation.
impl Shl<i16> for u128
[src]
type Output = Self
The resulting type after applying the <<
operator.
fn shl(self, other: i16) -> Self
[src]
Performs the <<
operation.
impl Shl<i32> for u128
[src]
type Output = Self
The resulting type after applying the <<
operator.
fn shl(self, other: i32) -> Self
[src]
Performs the <<
operation.
impl Shl<i64> for u128
[src]
type Output = Self
The resulting type after applying the <<
operator.
fn shl(self, other: i64) -> Self
[src]
Performs the <<
operation.
impl Shl<isize> for u128
[src]
type Output = Self
The resulting type after applying the <<
operator.
fn shl(self, other: isize) -> Self
[src]
Performs the <<
operation.
impl Shr<u8> for u128
[src]
type Output = Self
The resulting type after applying the >>
operator.
fn shr(self, other: u8) -> Self
[src]
Performs the >>
operation.
impl Shr<u16> for u128
[src]
type Output = Self
The resulting type after applying the >>
operator.
fn shr(self, other: u16) -> Self
[src]
Performs the >>
operation.
impl Shr<u32> for u128
[src]
type Output = Self
The resulting type after applying the >>
operator.
fn shr(self, other: u32) -> Self
[src]
Performs the >>
operation.
impl Shr<u64> for u128
[src]
type Output = Self
The resulting type after applying the >>
operator.
fn shr(self, other: u64) -> Self
[src]
Performs the >>
operation.
impl Shr<usize> for u128
[src]
type Output = Self
The resulting type after applying the >>
operator.
fn shr(self, other: usize) -> Self
[src]
Performs the >>
operation.
impl Shr<i8> for u128
[src]
type Output = Self
The resulting type after applying the >>
operator.
fn shr(self, other: i8) -> Self
[src]
Performs the >>
operation.
impl Shr<i16> for u128
[src]
type Output = Self
The resulting type after applying the >>
operator.
fn shr(self, other: i16) -> Self
[src]
Performs the >>
operation.
impl Shr<i32> for u128
[src]
type Output = Self
The resulting type after applying the >>
operator.
fn shr(self, other: i32) -> Self
[src]
Performs the >>
operation.
impl Shr<i64> for u128
[src]
type Output = Self
The resulting type after applying the >>
operator.
fn shr(self, other: i64) -> Self
[src]
Performs the >>
operation.
impl Shr<isize> for u128
[src]
type Output = Self
The resulting type after applying the >>
operator.
fn shr(self, other: isize) -> Self
[src]
Performs the >>
operation.
impl ShlAssign<u8> for u128
[src]
fn shl_assign(&mut self, other: u8)
[src]
Performs the <<=
operation.
impl ShlAssign<u16> for u128
[src]
fn shl_assign(&mut self, other: u16)
[src]
Performs the <<=
operation.
impl ShlAssign<u32> for u128
[src]
fn shl_assign(&mut self, other: u32)
[src]
Performs the <<=
operation.
impl ShlAssign<u64> for u128
[src]
fn shl_assign(&mut self, other: u64)
[src]
Performs the <<=
operation.
impl ShlAssign<usize> for u128
[src]
fn shl_assign(&mut self, other: usize)
[src]
Performs the <<=
operation.
impl ShlAssign<i8> for u128
[src]
fn shl_assign(&mut self, other: i8)
[src]
Performs the <<=
operation.
impl ShlAssign<i16> for u128
[src]
fn shl_assign(&mut self, other: i16)
[src]
Performs the <<=
operation.
impl ShlAssign<i32> for u128
[src]
fn shl_assign(&mut self, other: i32)
[src]
Performs the <<=
operation.
impl ShlAssign<i64> for u128
[src]
fn shl_assign(&mut self, other: i64)
[src]
Performs the <<=
operation.
impl ShlAssign<isize> for u128
[src]
fn shl_assign(&mut self, other: isize)
[src]
Performs the <<=
operation.
impl ShrAssign<u8> for u128
[src]
fn shr_assign(&mut self, other: u8)
[src]
Performs the >>=
operation.
impl ShrAssign<u16> for u128
[src]
fn shr_assign(&mut self, other: u16)
[src]
Performs the >>=
operation.
impl ShrAssign<u32> for u128
[src]
fn shr_assign(&mut self, other: u32)
[src]
Performs the >>=
operation.
impl ShrAssign<u64> for u128
[src]
fn shr_assign(&mut self, other: u64)
[src]
Performs the >>=
operation.
impl ShrAssign<usize> for u128
[src]
fn shr_assign(&mut self, other: usize)
[src]
Performs the >>=
operation.
impl ShrAssign<i8> for u128
[src]
fn shr_assign(&mut self, other: i8)
[src]
Performs the >>=
operation.
impl ShrAssign<i16> for u128
[src]
fn shr_assign(&mut self, other: i16)
[src]
Performs the >>=
operation.
impl ShrAssign<i32> for u128
[src]
fn shr_assign(&mut self, other: i32)
[src]
Performs the >>=
operation.
impl ShrAssign<i64> for u128
[src]
fn shr_assign(&mut self, other: i64)
[src]
Performs the >>=
operation.
impl ShrAssign<isize> for u128
[src]
fn shr_assign(&mut self, other: isize)
[src]
Performs the >>=
operation.
impl Mul<u128> for u128
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, other: u128) -> Self
[src]
Performs the *
operation.
impl Mul<u64> for u128
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, other: u64) -> Self
[src]
Performs the *
operation.
impl MulAssign<u128> for u128
[src]
fn mul_assign(&mut self, other: u128)
[src]
Performs the *=
operation.
impl MulAssign<u64> for u128
[src]
fn mul_assign(&mut self, other: u64)
[src]
Performs the *=
operation.
impl CheckedMul for u128
[src]
fn checked_mul(&self, other: &Self) -> Option<Self>
[src]
Multiplies two numbers, checking for underflow or overflow. If underflow or overflow happens, None
is returned. Read more
impl Div for u128
[src]
type Output = Self
The resulting type after applying the /
operator.
fn div(self, other: Self) -> Self
[src]
Performs the /
operation.
impl Rem for u128
[src]
type Output = Self
The resulting type after applying the %
operator.
fn rem(self, other: Self) -> Self
[src]
Performs the %
operation.
impl DivAssign<u128> for u128
[src]
fn div_assign(&mut self, other: u128)
[src]
Performs the /=
operation.
impl RemAssign<u128> for u128
[src]
fn rem_assign(&mut self, other: u128)
[src]
Performs the %=
operation.
impl CheckedDiv for u128
[src]
fn checked_div(&self, other: &Self) -> Option<Self>
[src]
Divides two numbers, checking for underflow, overflow and division by zero. If any of that happens, None
is returned. Read more
impl ToPrimitive for u128
[src]
fn to_i64(&self) -> Option<i64>
[src]
Converts the value of self
to an i64
.
fn to_u64(&self) -> Option<u64>
[src]
Converts the value of self
to an u64
.
fn to_f64(&self) -> Option<f64>
[src]
Converts the value of self
to an f64
.
fn to_isize(&self) -> Option<isize>
[src]
Converts the value of self
to an isize
.
fn to_i8(&self) -> Option<i8>
[src]
Converts the value of self
to an i8
.
fn to_i16(&self) -> Option<i16>
[src]
Converts the value of self
to an i16
.
fn to_i32(&self) -> Option<i32>
[src]
Converts the value of self
to an i32
.
fn to_usize(&self) -> Option<usize>
[src]
Converts the value of self
to a usize
.
fn to_u8(&self) -> Option<u8>
[src]
Converts the value of self
to an u8
.
fn to_u16(&self) -> Option<u16>
[src]
Converts the value of self
to an u16
.
fn to_u32(&self) -> Option<u32>
[src]
Converts the value of self
to an u32
.
fn to_f32(&self) -> Option<f32>
[src]
Converts the value of self
to an f32
.
impl FromPrimitive for u128
[src]
fn from_u64(n: u64) -> Option<u128>
[src]
Convert an u64
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_i64(n: i64) -> Option<u128>
[src]
Convert an i64
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_f64(n: f64) -> Option<u128>
[src]
Convert a f64
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_isize(n: isize) -> Option<Self>
[src]
Convert an isize
to return an optional value of this type. If the value cannot be represented by this value, the None
is returned. Read more
fn from_i8(n: i8) -> Option<Self>
[src]
Convert an i8
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_i16(n: i16) -> Option<Self>
[src]
Convert an i16
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_i32(n: i32) -> Option<Self>
[src]
Convert an i32
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_usize(n: usize) -> Option<Self>
[src]
Convert a usize
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_u8(n: u8) -> Option<Self>
[src]
Convert an u8
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_u16(n: u16) -> Option<Self>
[src]
Convert an u16
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_u32(n: u32) -> Option<Self>
[src]
Convert an u32
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
fn from_f32(n: f32) -> Option<Self>
[src]
Convert a f32
to return an optional value of this type. If the type cannot be represented by this value, the None
is returned. Read more
impl ToExtraPrimitive for u128
[src]
fn to_u128(&self) -> Option<u128>
[src]
Tries to convert itself into an unsigned 128-bit integer.
fn to_i128(&self) -> Option<i128>
[src]
Tries to convert itself into a signed 128-bit integer.
impl From<u8> for u128
[src]
impl From<u16> for u128
[src]
impl From<u32> for u128
[src]
impl From<u64> for u128
[src]
impl From<u128> for u128
[src]
impl Bounded for u128
[src]
fn min_value() -> Self
[src]
returns the smallest finite number this type can represent
fn max_value() -> Self
[src]
returns the largest finite number this type can represent
impl Zero for u128
[src]
fn zero() -> Self
[src]
Returns the additive identity element of Self
, 0
. Read more
fn is_zero(&self) -> bool
[src]
Returns true
if self
is equal to the additive identity.
impl One for u128
[src]
impl PrimInt for u128
[src]
fn count_ones(self) -> u32
[src]
Returns the number of ones in the binary representation of self
. Read more
fn count_zeros(self) -> u32
[src]
Returns the number of zeros in the binary representation of self
. Read more
fn leading_zeros(self) -> u32
[src]
Returns the number of leading zeros in the binary representation of self
. Read more
fn trailing_zeros(self) -> u32
[src]
Returns the number of trailing zeros in the binary representation of self
. Read more
fn rotate_left(self, shift: u32) -> Self
[src]
Shifts the bits to the left by a specified amount amount, n
, wrapping the truncated bits to the end of the resulting integer. Read more
fn rotate_right(self, shift: u32) -> Self
[src]
Shifts the bits to the right by a specified amount amount, n
, wrapping the truncated bits to the beginning of the resulting integer. Read more
fn swap_bytes(self) -> Self
[src]
Reverses the byte order of the integer. Read more
fn from_be(x: Self) -> Self
[src]
Convert an integer from big endian to the target's endianness. Read more
fn from_le(x: Self) -> Self
[src]
Convert an integer from little endian to the target's endianness. Read more
fn to_be(self) -> Self
[src]
Convert self
to big endian from the target's endianness. Read more
fn to_le(self) -> Self
[src]
Convert self
to little endian from the target's endianness. Read more
fn pow(self, exp: u32) -> Self
[src]
Raises self to the power of exp
, using exponentiation by squaring. Read more
fn signed_shl(self, shift: u32) -> Self
[src]
Shifts the bits to the left by a specified amount amount, n
, filling zeros in the least significant bits. Read more
fn signed_shr(self, shift: u32) -> Self
[src]
Shifts the bits to the right by a specified amount amount, n
, copying the "sign bit" in the most significant bits even for unsigned types. Read more
fn unsigned_shl(self, shift: u32) -> Self
[src]
Shifts the bits to the left by a specified amount amount, n
, filling zeros in the least significant bits. Read more
fn unsigned_shr(self, shift: u32) -> Self
[src]
Shifts the bits to the right by a specified amount amount, n
, filling zeros in the most significant bits. Read more
impl Unsigned for u128
[src]
impl Num for u128
[src]
type FromStrRadixErr = ParseIntError
fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>
[src]
Convert from a string and radix <= 36. Read more
impl FromStr for u128
[src]
type Err = ParseIntError
The associated error which can be returned from parsing.
fn from_str(src: &str) -> Result<Self, ParseIntError>
[src]
Parses a string s
to return a value of this type. Read more
impl Display for u128
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Debug for u128
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result
[src]
Formats the value using the given formatter.
impl Binary for u128
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result
[src]
Formats the value using the given formatter.
impl LowerHex for u128
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result
[src]
Formats the value using the given formatter.
impl UpperHex for u128
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result
[src]
Formats the value using the given formatter.
impl Octal for u128
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result
[src]
Formats the value using the given formatter.
impl Sum for u128
[src]
fn sum<I>(iter: I) -> Self where
I: Iterator<Item = Self>,
[src]
I: Iterator<Item = Self>,
Method which takes an iterator and generates Self
from the elements by "summing up" the items. Read more
impl Product for u128
[src]
fn product<I>(iter: I) -> Self where
I: Iterator<Item = Self>,
[src]
I: Iterator<Item = Self>,
Method which takes an iterator and generates Self
from the elements by multiplying the items. Read more
impl<'a> Sum<&'a u128> for u128
[src]
fn sum<I>(iter: I) -> Self where
I: Iterator<Item = &'a Self>,
[src]
I: Iterator<Item = &'a Self>,
Method which takes an iterator and generates Self
from the elements by "summing up" the items. Read more