Struct extprim::i128::i128
[−]
[src]
#[repr(C)]pub struct i128(_);
An signed 128-bit number.
Methods
impl i128
[src]
const fn new(lo: i64) -> i128
Constructs a new 128-bit integer from a 64-bit integer.
const fn from_built_in(value: i128) -> i128
Constructs a new 128-bit integer from the built-in 128-bit integer.
fn from_parts(hi: i64, lo: u64) -> i128
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
.
use extprim::i128::i128; let number = i128::from_parts(-6692605943, 4362896299872285998); assert_eq!(format!("{}", number), "-123456789012345678901234567890"); // Note: -123456789012345678901234567890 = -6692605943 << 64 | 4362896299872285998
fn low64(self) -> u64
Fetch the lower-64-bit of the number.
Examples
use extprim::i128::i128; let number = i128::from_str_radix("-2ec6f5f523d047254447e8b26a3665", 16).unwrap(); assert_eq!(number.low64(), 0xdabbb8174d95c99bu64);
fn high64(self) -> i64
Fetch the higher-64-bit of the number.
Examples
use extprim::i128::i128; let number = i128::from_str_radix("-2ec6f5f523d047254447e8b26a3665", 16).unwrap(); assert_eq!(number.high64(), -0x2ec6f5f523d048i64);
fn as_u128(self) -> u128
Convert this number to unsigned 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) -> i128
Converts this number to the built-in 128-bit integer type.
impl i128
[src]
fn wrapping_add(self, other: i128) -> i128
Wrapping (modular) addition. Computes self + other
, wrapping around at the boundary of
the type.
Examples
use extprim::i128::i128; assert_eq!(i128::new(5).wrapping_add(i128::new(-6)), i128::new(-1)); assert_eq!(i128::max_value().wrapping_add(i128::one()), i128::min_value());
fn wrapping_sub(self, other: i128) -> i128
Wrapping (modular) subtraction. Computes self - other
, wrapping around at the boundary of
the type.
Examples
use extprim::i128::i128; assert_eq!(i128::new(6).wrapping_sub(i128::new(13)), i128::new(-7)); assert_eq!(i128::min_value().wrapping_sub(i128::one()), i128::max_value());
fn wrapping_neg(self) -> i128
Wrapping (modular) negation. Computes -self
, wrapping around at the boundary of the type.
The only case where such wrapping can occur is when one negates MIN on a signed type (where MIN is the negative minimal value for the type); this is a positive value that is too large to represent in the type. In such a case, this function returns MIN itself.
Examples
use extprim::i128::i128; assert_eq!(i128::new(7).wrapping_neg(), i128::new(-7)); assert_eq!(i128::min_value().wrapping_neg(), i128::min_value());
fn overflowing_add(self, other: i128) -> (i128, bool)
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::i128::i128; assert_eq!(i128::new(6).overflowing_add(i128::new(13)), (i128::new(19), false)); assert_eq!(i128::max_value().overflowing_add(i128::one()), (i128::min_value(), true));
fn overflowing_sub(self, other: i128) -> (i128, bool)
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::i128::i128; assert_eq!(i128::new(3).overflowing_sub(i128::new(8)), (i128::new(-5), false)); assert_eq!(i128::min_value().overflowing_sub(i128::max_value()), (i128::one(), true));
fn overflowing_neg(self) -> (i128, bool)
Negates self
, overflowing if this is equal to the minimum value.
Returns a tuple of the negated version of self along with a boolean indicating whether an
overflow happened. If self is the minimum value (i128::MIN
), then the minimum value will
be returned again and true will be returned for an overflow happening.
Examples
use extprim::i128::i128; assert_eq!(i128::new(7).overflowing_neg(), (i128::new(-7), false)); assert_eq!(i128::min_value().overflowing_neg(), (i128::min_value(), true));
fn checked_neg(self) -> Option<i128>
Checked negation. Computes -self
, returning None
if self == MIN
.
Examples
use extprim::i128::i128; assert_eq!(i128::new(7).checked_neg(), Some(i128::new(-7))); assert_eq!(i128::min_value().checked_neg(), None);
fn saturating_add(self, other: i128) -> i128
Saturating integer addition. Computes self + other
, saturating at the numeric bounds
instead of overflowing.
Examples
use extprim::i128::i128; assert_eq!(i128::new(6).saturating_add(i128::new(13)), i128::new(19)); assert_eq!(i128::max_value().saturating_add(i128::new(2)), i128::max_value()); assert_eq!(i128::min_value().saturating_add(i128::new(-2)), i128::min_value());
fn saturating_sub(self, other: i128) -> i128
Saturating integer subtraction. Computes self - other
, saturating at the numeric bounds
instead of overflowing.
Examples
use extprim::i128::i128; assert_eq!(i128::new(3).saturating_sub(i128::new(8)), i128::new(-5)); assert_eq!(i128::max_value().saturating_sub(i128::new(-2)), i128::max_value()); assert_eq!(i128::min_value().saturating_sub(i128::new(2)), i128::min_value());
fn saturating_neg(self) -> i128
Saturating integer negation. Computes -self
, saturating at numeric bounds instead of
overflowing.
Examples
use extprim::i128::i128; assert_eq!(i128::new(7).saturating_neg(), i128::new(-7)); assert_eq!(i128::min_value().saturating_neg(), i128::max_value()); assert_eq!(i128::max_value().saturating_neg(), i128::min_value() + i128::one());
impl i128
[src]
fn checked_add(self, other: i128) -> Option<i128>
Checked integer addition. Computes self + other
, returning None
if overflow occurred.
Examples
use extprim::i128::i128; assert_eq!(i128::new(5).checked_add(i128::new(-6)), Some(i128::new(-1))); assert_eq!(i128::max_value().checked_add(i128::one()), None);
impl i128
[src]
fn checked_sub(self, other: i128) -> Option<i128>
Checked integer subtraction. Computes self - other
, returning None
if underflow
occurred.
Examples
use extprim::i128::i128; assert_eq!(i128::new(6).checked_sub(i128::new(13)), Some(i128::new(-7))); assert_eq!(i128::min_value().checked_sub(i128::one()), None);
impl i128
[src]
fn wrapping_shl(self, shift: u32) -> i128
Panic-free bitwise shift-left; yields self << (shift % 128)
.
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. The primitive integer types all implement a rotate_left
function, which may be what you want instead.
Examples
use extprim::i128::i128; assert_eq!(i128::new(1).wrapping_shl(127), i128::min_value()); assert_eq!(i128::new(19).wrapping_shl(256), i128::new(19));
fn wrapping_shr(self, shift: u32) -> i128
Panic-free bitwise shift-right; yields `self >> (shift % 128).
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. The primitive integer types all implement a rotate_right
function, which may be what you want instead.
Examples
use extprim::i128::i128; assert_eq!(i128::new(-50).wrapping_shr(2), i128::new(-13)); assert_eq!(i128::new(19).wrapping_shr(257), i128::new(9));
fn overflowing_shl(self, other: u32) -> (i128, bool)
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. 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::i128::i128; assert_eq!(i128::new(1).overflowing_shl(127), (i128::min_value(), false)); assert_eq!(i128::new(19).overflowing_shl(256), (i128::new(19), true));
fn overflowing_shr(self, other: u32) -> (i128, bool)
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. 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::i128::i128; assert_eq!(i128::new(-50).overflowing_shr(2), (i128::new(-13), false)); assert_eq!(i128::new(19).overflowing_shr(257), (i128::new(9), true));
impl i128
[src]
fn checked_shl(self, other: u32) -> Option<i128>
Checked shift left. Computes self << other
, returning None
if rhs is larger than or
equal to the number of bits in self
(128).
Examples
use extprim::i128::i128; assert_eq!(i128::new(1).checked_shl(127), Some(i128::min_value())); assert_eq!(i128::new(19).checked_shl(256), None);
impl i128
[src]
fn checked_shr(self, other: u32) -> Option<i128>
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::i128::i128; assert_eq!(i128::new(-50).checked_shr(2), Some(i128::new(-13))); assert_eq!(i128::new(19).checked_shr(257), None);
impl i128
[src]
fn overflowing_mul(self, other: i128) -> (i128, bool)
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::i128::i128; assert_eq!(i128::new(-6).overflowing_mul(i128::new(11)), (i128::new(-66), false)); let a = i128::from_parts(3, 1); let b = i128::from_parts(-1, 3); assert_eq!(a.overflowing_mul(b), (i128::from_parts(8, 3), true));
fn wrapping_mul(self, other: i128) -> i128
Wrapping (modular) multiplication. Computes self * other
, wrapping around at the boundary
of the type.
Examples
use extprim::i128::i128; assert_eq!(i128::new(-6).wrapping_mul(i128::new(11)), i128::new(-66)); let a = i128::from_parts(3, 1); let b = i128::from_parts(-1, 3); assert_eq!(a.wrapping_mul(b), i128::from_parts(8, 3));
fn saturating_mul(self, other: i128) -> i128
Saturating integer multiplication. Computes self * other
, saturating at the numeric
bounds instead of overflowing.
Examples
use extprim::i128::i128; assert_eq!(i128::new(-6).saturating_mul(i128::new(11)), i128::new(-66)); let a = i128::from_parts(3, 1); let b = i128::from_parts(-1, 3); assert_eq!(a.saturating_mul(b), i128::min_value());
impl i128
[src]
fn checked_mul(self, other: i128) -> Option<i128>
Checked integer multiplication. Computes self * other
, returning None
if underflow or
overflow occurred.
Examples
use extprim::i128::i128; assert_eq!(i128::new(-6).checked_mul(i128::new(11)), Some(i128::new(-66))); let a = i128::from_parts(3, 1); let b = i128::from_parts(-1, 3); assert_eq!(a.checked_mul(b), None);
impl i128
[src]
fn wrapping_div(self, other: i128) -> i128
Wrapping (modular) division. Computes self / other
, wrapping around at the boundary of
the type.
The only case where such wrapping can occur is when one divides MIN / -1
; this is
equivalent to -MIN
, a positive value that is too large to represent in the type. In such
a case, this function returns MIN
itself.
Panics
This function will panic if other
is 0.
Examples
use extprim::i128::i128; assert_eq!(i128::new(100).wrapping_div(i128::new(-8)), i128::new(-12)); assert_eq!(i128::min_value().wrapping_div(i128::new(-1)), i128::min_value());
fn wrapping_rem(self, other: i128) -> i128
Wrapping (modular) remainder. Computes self % other
, wrapping around at the boundary of
the type.
Such wrap-around never actually occurs mathematically; implementation artifacts make
x % y
invalid for MIN / -1
on a signed type. In such a case, this function returns 0.
Panics
This function will panic if other
is 0.
Examples
use extprim::i128::i128; assert_eq!(i128::new(100).wrapping_rem(i128::new(-8)), i128::new(4)); assert_eq!(i128::min_value().wrapping_rem(i128::new(-1)), i128::zero());
fn overflowing_div(self, other: i128) -> (i128, bool)
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. If an overflow would occur then self is returned.
Panics
This function will panic if other
is 0.
Examples
use extprim::i128::i128; assert_eq!(i128::new(100).overflowing_div(i128::new(-8)), (i128::new(-12), false)); assert_eq!(i128::min_value().overflowing_div(i128::new(-1)), (i128::min_value(), true));
fn overflowing_rem(self, other: i128) -> (i128, bool)
Calculates the remainder when self
is divided by other
.
Returns a tuple of the remainder after dividing along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would occur then 0 is returned.
Panics
This function will panic if other
is 0.
Examples
use extprim::i128::i128; assert_eq!(i128::new(100).overflowing_rem(i128::new(-8)), (i128::new(4), false)); assert_eq!(i128::min_value().overflowing_rem(i128::new(-1)), (i128::zero(), true));
fn checked_div(self, other: i128) -> Option<i128>
Checked integer division. Computes self / other
, returning None
if other == 0
or the
operation results in underflow or overflow.
Examples
use extprim::i128::i128; assert_eq!(i128::new(100).checked_div(i128::new(-8)), Some(i128::new(-12))); assert_eq!(i128::min_value().checked_div(i128::new(-1)), None); assert_eq!(i128::new(3).checked_div(i128::zero()), None);
fn checked_rem(self, other: i128) -> Option<i128>
Checked integer remainder. Computes self % other
, returning None
if other == 0
or the
operation results in underflow or overflow.
Examples
use extprim::i128::i128; assert_eq!(i128::new(100).checked_rem(i128::new(-8)), Some(i128::new(4))); assert_eq!(i128::min_value().checked_rem(i128::new(-1)), None); assert_eq!(i128::new(3).checked_rem(i128::zero()), None);
impl i128
[src]
fn min_value() -> i128
Returns the smallest signed 128-bit integer
(-170_141_183_460_469_231_731_687_303_715_884_105_728
).
fn max_value() -> i128
Returns the largest signed 128-bit integer
(170_141_183_460_469_231_731_687_303_715_884_105_727
).
fn zero() -> i128
Returns the constant 0.
fn one() -> i128
Returns the constant 1.
impl i128
[src]
fn count_ones(self) -> u32
Returns the number of ones in the binary representation of self
.
Examples
use extprim::i128::i128; assert_eq!(i128::new(-1000).count_ones(), 120);
fn count_zeros(self) -> u32
Returns the number of zeros in the binary representation of self
.
Examples
use extprim::i128::i128; assert_eq!(i128::new(-1000).count_zeros(), 8);
fn leading_zeros(self) -> u32
Returns the number of leading zeros in the binary representation of self
.
use extprim::i128::i128; assert_eq!(i128::zero().leading_zeros(), 128); assert_eq!(i128::one().leading_zeros(), 127); assert_eq!(i128::new(-1).leading_zeros(), 0); assert_eq!(i128::max_value().leading_zeros(), 1); assert_eq!((i128::one() << 24u32).leading_zeros(), 103); assert_eq!((i128::one() << 124u32).leading_zeros(), 3);
fn trailing_zeros(self) -> u32
Returns the number of trailing zeros in the binary representation of self
.
Examples
use extprim::i128::i128; assert_eq!(i128::zero().trailing_zeros(), 128); assert_eq!(i128::one().trailing_zeros(), 0); assert_eq!(i128::min_value().trailing_zeros(), 127); assert_eq!((i128::one() << 24u32).trailing_zeros(), 24); assert_eq!((i128::one() << 124u32).trailing_zeros(), 124);
fn rotate_left(self, shift: u32) -> i128
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::i128::i128; let a = i128::from_str_radix("29c30f1029939b146664242d97d9f649", 16).unwrap(); let b = i128::from_str_radix("-1e7877eb363275cccdede9341304db6c", 16).unwrap(); assert_eq!(a.rotate_left(7), b);
fn rotate_right(self, shift: u32) -> i128
Shifts the bits to the right by a specified amount, shift
, wrapping the truncated bits to
the end of the resulting integer.
Examples
use extprim::i128::i128; let a = i128::from_str_radix("29c30f1029939b146664242d97d9f649", 16).unwrap(); let b = i128::from_str_radix("-6dac79e1dfacd8c9d73337b7a4d04c14", 16).unwrap(); assert_eq!(a.rotate_right(7), b);
fn swap_bytes(self) -> i128
Reverses the byte order of the integer.
Examples
use extprim::i128::i128; let a = i128::from_str_radix("11122233344455560123456789abcdef", 16).unwrap(); let b = i128::from_str_radix("-1032547698badcfea9aabbcbccddedef", 16).unwrap(); assert_eq!(a.swap_bytes(), b);
fn from_be(x: Self) -> Self
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
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
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
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
Raises self
to the power of exp
, using exponentiation by squaring.
Examples
use extprim::i128::i128; use std::str::FromStr; assert_eq!(i128::new(-5).pow(29), i128::from_str("-186264514923095703125").unwrap()); assert_eq!(i128::new(-5).pow(30), i128::from_str("931322574615478515625").unwrap());
impl i128
[src]
fn abs(self) -> Self
Computes the absolute value of self
.
Overflow behavior
The absolute value of i128::MIN
cannot be represented as an i128
, and attempting to
calculate it will cause an overflow. This means that code in debug mode will trigger a
panic on this case and optimized code will return MIN
without a panic.
Examples
use extprim::i128::i128; use std::i64; assert_eq!(i128::new(10).abs(), i128::new(10)); assert_eq!(i128::new(-10).abs(), i128::new(10)); assert_eq!(i128::new(i64::MIN).abs(), i128::from_parts(0, 0x80000000_00000000));
fn signum(self) -> Self
Returns a number representing sign of self
.
0
if the number is zero1
if the number is positive-1
if the number is negative
Examples
use extprim::i128::i128; assert_eq!(i128::max_value().signum(), i128::one()); assert_eq!(i128::zero().signum(), i128::zero()); assert_eq!(i128::min_value().signum(), -i128::one());
fn is_positive(self) -> bool
Returns true
if self
is positive and false
if the number is zero or negative.
Examples
use extprim::i128::i128; assert!( i128::max_value().is_positive()); assert!(! i128::zero().is_positive()); assert!(! i128::min_value().is_positive());
fn is_negative(self) -> bool
Returns true
if self
is negative and false
if the number is zero or positive.
Examples
use extprim::i128::i128; assert!(! i128::max_value().is_negative()); assert!(! i128::zero().is_negative()); assert!( i128::min_value().is_negative());
impl i128
[src]
fn from_str_radix(src: &str, radix: u32) -> Result<i128, ParseIntError>
Converts a string slice in a given base to an integer.
Leading and trailing whitespace represent an error.
Examples
use extprim::i128::i128; assert_eq!(i128::from_str_radix("123456abcdef1234567890", 16), Ok(i128::from_parts(0x123456, 0xabcdef1234567890)));
Trait Implementations
impl NumCast for i128
[src]
fn from<T: ToPrimitive>(n: T) -> Option<i128>
Creates a number from another value that can be converted into a primitive via the ToPrimitive
trait. Read more
impl Default for i128
[src]
impl Copy for i128
[src]
impl Clone for i128
[src]
fn clone(&self) -> i128
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Hash for i128
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialEq for i128
[src]
fn eq(&self, __arg_0: &i128) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &i128) -> bool
This method tests for !=
.
impl Eq for i128
[src]
impl Rand for i128
[src]
fn rand<R: Rng>(rng: &mut R) -> i128
Generates a random instance of this type using the specified source of randomness. Read more
impl Add<i128> for i128
[src]
type Output = Self
The resulting type after applying the +
operator
fn add(self, other: i128) -> Self
The method for the +
operator
impl Sub<i128> for i128
[src]
type Output = Self
The resulting type after applying the -
operator
fn sub(self, other: i128) -> Self
The method for the -
operator
impl AddAssign<i128> for i128
[src]
fn add_assign(&mut self, other: i128)
The method for the +=
operator
impl SubAssign<i128> for i128
[src]
fn sub_assign(&mut self, other: i128)
The method for the -=
operator
impl Neg for i128
[src]
type Output = Self
The resulting type after applying the -
operator
fn neg(self) -> Self
The method for the unary -
operator
impl CheckedAdd for i128
[src]
fn checked_add(&self, other: &Self) -> Option<Self>
Adds two numbers, checking for overflow. If overflow happens, None
is returned. Read more
impl CheckedSub for i128
[src]
fn checked_sub(&self, other: &Self) -> Option<Self>
Subtracts two numbers, checking for underflow. If underflow happens, None
is returned. Read more
impl Saturating for i128
[src]
fn saturating_add(self, other: Self) -> Self
Saturating addition operator. Returns a+b, saturating at the numeric bounds instead of overflowing. Read more
fn saturating_sub(self, other: Self) -> Self
Saturating subtraction operator. Returns a-b, saturating at the numeric bounds instead of overflowing. Read more
impl PartialOrd for i128
[src]
fn partial_cmp(&self, other: &i128) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
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
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
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
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for i128
[src]
fn cmp(&self, other: &i128) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl Not for i128
[src]
type Output = Self
The resulting type after applying the !
operator
fn not(self) -> Self
The method for the unary !
operator
impl BitAnd for i128
[src]
type Output = Self
The resulting type after applying the &
operator
fn bitand(self, other: Self) -> Self
The method for the &
operator
impl BitOr for i128
[src]
type Output = Self
The resulting type after applying the |
operator
fn bitor(self, other: Self) -> Self
The method for the |
operator
impl BitXor for i128
[src]
type Output = Self
The resulting type after applying the ^
operator
fn bitxor(self, other: Self) -> Self
The method for the ^
operator
impl BitAndAssign<i128> for i128
[src]
fn bitand_assign(&mut self, other: i128)
The method for the &=
operator
impl BitOrAssign<i128> for i128
[src]
fn bitor_assign(&mut self, other: i128)
The method for the |=
operator
impl BitXorAssign<i128> for i128
[src]
fn bitxor_assign(&mut self, other: i128)
The method for the ^=
operator
impl Shl<u8> for i128
[src]
type Output = Self
The resulting type after applying the <<
operator
fn shl(self, other: u8) -> Self
The method for the <<
operator
impl Shl<u16> for i128
[src]
type Output = Self
The resulting type after applying the <<
operator
fn shl(self, other: u16) -> Self
The method for the <<
operator
impl Shl<u32> for i128
[src]
type Output = Self
The resulting type after applying the <<
operator
fn shl(self, other: u32) -> Self
The method for the <<
operator
impl Shl<u64> for i128
[src]
type Output = Self
The resulting type after applying the <<
operator
fn shl(self, other: u64) -> Self
The method for the <<
operator
impl Shl<usize> for i128
[src]
type Output = Self
The resulting type after applying the <<
operator
fn shl(self, other: usize) -> Self
The method for the <<
operator
impl Shl<i8> for i128
[src]
type Output = Self
The resulting type after applying the <<
operator
fn shl(self, other: i8) -> Self
The method for the <<
operator
impl Shl<i16> for i128
[src]
type Output = Self
The resulting type after applying the <<
operator
fn shl(self, other: i16) -> Self
The method for the <<
operator
impl Shl<i32> for i128
[src]
type Output = Self
The resulting type after applying the <<
operator
fn shl(self, other: i32) -> Self
The method for the <<
operator
impl Shl<i64> for i128
[src]
type Output = Self
The resulting type after applying the <<
operator
fn shl(self, other: i64) -> Self
The method for the <<
operator
impl Shl<isize> for i128
[src]
type Output = Self
The resulting type after applying the <<
operator
fn shl(self, other: isize) -> Self
The method for the <<
operator
impl Shr<u8> for i128
[src]
type Output = Self
The resulting type after applying the >>
operator
fn shr(self, other: u8) -> Self
The method for the >>
operator
impl Shr<u16> for i128
[src]
type Output = Self
The resulting type after applying the >>
operator
fn shr(self, other: u16) -> Self
The method for the >>
operator
impl Shr<u32> for i128
[src]
type Output = Self
The resulting type after applying the >>
operator
fn shr(self, other: u32) -> Self
The method for the >>
operator
impl Shr<u64> for i128
[src]
type Output = Self
The resulting type after applying the >>
operator
fn shr(self, other: u64) -> Self
The method for the >>
operator
impl Shr<usize> for i128
[src]
type Output = Self
The resulting type after applying the >>
operator
fn shr(self, other: usize) -> Self
The method for the >>
operator
impl Shr<i8> for i128
[src]
type Output = Self
The resulting type after applying the >>
operator
fn shr(self, other: i8) -> Self
The method for the >>
operator
impl Shr<i16> for i128
[src]
type Output = Self
The resulting type after applying the >>
operator
fn shr(self, other: i16) -> Self
The method for the >>
operator
impl Shr<i32> for i128
[src]
type Output = Self
The resulting type after applying the >>
operator
fn shr(self, other: i32) -> Self
The method for the >>
operator
impl Shr<i64> for i128
[src]
type Output = Self
The resulting type after applying the >>
operator
fn shr(self, other: i64) -> Self
The method for the >>
operator
impl Shr<isize> for i128
[src]
type Output = Self
The resulting type after applying the >>
operator
fn shr(self, other: isize) -> Self
The method for the >>
operator
impl ShlAssign<u8> for i128
[src]
fn shl_assign(&mut self, other: u8)
The method for the <<=
operator
impl ShlAssign<u16> for i128
[src]
fn shl_assign(&mut self, other: u16)
The method for the <<=
operator
impl ShlAssign<u32> for i128
[src]
fn shl_assign(&mut self, other: u32)
The method for the <<=
operator
impl ShlAssign<u64> for i128
[src]
fn shl_assign(&mut self, other: u64)
The method for the <<=
operator
impl ShlAssign<usize> for i128
[src]
fn shl_assign(&mut self, other: usize)
The method for the <<=
operator
impl ShlAssign<i8> for i128
[src]
fn shl_assign(&mut self, other: i8)
The method for the <<=
operator
impl ShlAssign<i16> for i128
[src]
fn shl_assign(&mut self, other: i16)
The method for the <<=
operator
impl ShlAssign<i32> for i128
[src]
fn shl_assign(&mut self, other: i32)
The method for the <<=
operator
impl ShlAssign<i64> for i128
[src]
fn shl_assign(&mut self, other: i64)
The method for the <<=
operator
impl ShlAssign<isize> for i128
[src]
fn shl_assign(&mut self, other: isize)
The method for the <<=
operator
impl ShrAssign<u8> for i128
[src]
fn shr_assign(&mut self, other: u8)
The method for the >>=
operator
impl ShrAssign<u16> for i128
[src]
fn shr_assign(&mut self, other: u16)
The method for the >>=
operator
impl ShrAssign<u32> for i128
[src]
fn shr_assign(&mut self, other: u32)
The method for the >>=
operator
impl ShrAssign<u64> for i128
[src]
fn shr_assign(&mut self, other: u64)
The method for the >>=
operator
impl ShrAssign<usize> for i128
[src]
fn shr_assign(&mut self, other: usize)
The method for the >>=
operator
impl ShrAssign<i8> for i128
[src]
fn shr_assign(&mut self, other: i8)
The method for the >>=
operator
impl ShrAssign<i16> for i128
[src]
fn shr_assign(&mut self, other: i16)
The method for the >>=
operator
impl ShrAssign<i32> for i128
[src]
fn shr_assign(&mut self, other: i32)
The method for the >>=
operator
impl ShrAssign<i64> for i128
[src]
fn shr_assign(&mut self, other: i64)
The method for the >>=
operator
impl ShrAssign<isize> for i128
[src]
fn shr_assign(&mut self, other: isize)
The method for the >>=
operator
impl Mul<i128> for i128
[src]
type Output = Self
The resulting type after applying the *
operator
fn mul(self, other: i128) -> Self
The method for the *
operator
impl MulAssign<i128> for i128
[src]
fn mul_assign(&mut self, other: i128)
The method for the *=
operator
impl CheckedMul for i128
[src]
fn checked_mul(&self, other: &Self) -> Option<Self>
Multiplies two numbers, checking for underflow or overflow. If underflow or overflow happens, None
is returned. Read more
impl Div for i128
[src]
type Output = Self
The resulting type after applying the /
operator
fn div(self, other: Self) -> Self
The method for the /
operator
impl Rem for i128
[src]
type Output = Self
The resulting type after applying the %
operator
fn rem(self, other: Self) -> Self
The method for the %
operator
impl DivAssign<i128> for i128
[src]
fn div_assign(&mut self, other: i128)
The method for the /=
operator
impl RemAssign<i128> for i128
[src]
fn rem_assign(&mut self, other: i128)
The method for the %=
operator
impl CheckedDiv for i128
[src]
fn checked_div(&self, other: &Self) -> Option<Self>
Divides two numbers, checking for underflow, overflow and division by zero. If any of that happens, None
is returned. Read more
impl ToPrimitive for i128
[src]
fn to_i64(&self) -> Option<i64>
Converts the value of self
to an i64
.
fn to_u64(&self) -> Option<u64>
Converts the value of self
to an u64
.
fn to_f64(&self) -> Option<f64>
Converts the value of self
to an f64
.
fn to_isize(&self) -> Option<isize>
Converts the value of self
to an isize
.
fn to_i8(&self) -> Option<i8>
Converts the value of self
to an i8
.
fn to_i16(&self) -> Option<i16>
Converts the value of self
to an i16
.
fn to_i32(&self) -> Option<i32>
Converts the value of self
to an i32
.
fn to_usize(&self) -> Option<usize>
Converts the value of self
to a usize
.
fn to_u8(&self) -> Option<u8>
Converts the value of self
to an u8
.
fn to_u16(&self) -> Option<u16>
Converts the value of self
to an u16
.
fn to_u32(&self) -> Option<u32>
Converts the value of self
to an u32
.
fn to_f32(&self) -> Option<f32>
Converts the value of self
to an f32
.
impl FromPrimitive for i128
[src]
fn from_u64(n: u64) -> Option<i128>
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<i128>
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<i128>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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 i128
[src]
fn to_u128(&self) -> Option<u128>
Tries to convert itself into an unsigned 128-bit integer.
fn to_i128(&self) -> Option<i128>
Tries to convert itself into a signed 128-bit integer.
impl From<i8> for i128
[src]
impl From<i16> for i128
[src]
impl From<i32> for i128
[src]
impl From<i64> for i128
[src]
impl From<i128> for i128
[src]
impl Bounded for i128
[src]
fn min_value() -> Self
returns the smallest finite number this type can represent
fn max_value() -> Self
returns the largest finite number this type can represent
impl Zero for i128
[src]
fn zero() -> Self
Returns the additive identity element of Self
, 0
. Read more
fn is_zero(&self) -> bool
Returns true
if self
is equal to the additive identity.
impl One for i128
[src]
impl PrimInt for i128
[src]
fn count_ones(self) -> u32
Returns the number of ones in the binary representation of self
. Read more
fn count_zeros(self) -> u32
Returns the number of zeros in the binary representation of self
. Read more
fn leading_zeros(self) -> u32
Returns the number of leading zeros in the binary representation of self
. Read more
fn trailing_zeros(self) -> u32
Returns the number of trailing zeros in the binary representation of self
. Read more
fn rotate_left(self, shift: u32) -> Self
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
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
Reverses the byte order of the integer. Read more
fn from_be(x: Self) -> Self
Convert an integer from big endian to the target's endianness. Read more
fn from_le(x: Self) -> Self
Convert an integer from little endian to the target's endianness. Read more
fn to_be(self) -> Self
Convert self
to big endian from the target's endianness. Read more
fn to_le(self) -> Self
Convert self
to little endian from the target's endianness. Read more
fn pow(self, exp: u32) -> Self
Raises self to the power of exp
, using exponentiation by squaring. Read more
fn signed_shl(self, shift: u32) -> Self
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
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
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
Shifts the bits to the right by a specified amount amount, n
, filling zeros in the most significant bits. Read more
impl Signed for i128
[src]
fn abs(&self) -> Self
Computes the absolute value. Read more
fn signum(&self) -> Self
Returns the sign of the number. Read more
fn is_positive(&self) -> bool
Returns true if the number is positive and false if the number is zero or negative.
fn is_negative(&self) -> bool
Returns true if the number is negative and false if the number is zero or positive.
fn abs_sub(&self, other: &Self) -> Self
The positive difference of two numbers. Read more
impl Num for i128
[src]
type FromStrRadixErr = ParseIntError
fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseIntError>
Convert from a string and radix <= 36. Read more
impl FromStr for i128
[src]
type Err = ParseIntError
The associated error which can be returned from parsing.
fn from_str(src: &str) -> Result<i128, ParseIntError>
Parses a string s
to return a value of this type. Read more
impl Binary for i128
[src]
impl LowerHex for i128
[src]
impl UpperHex for i128
[src]
impl Octal for i128
[src]
impl Display for i128
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result
Formats the value using the given formatter. Read more