Struct ethers::core::types::I256[][src]

pub struct I256(_);
Expand description

Little-endian 256-bit signed integer.

Implementations

Maximum value.

Minimum value.

Zero (additive identity) of this type.

One (multiplicative identity) of this type.

Minus one (multiplicative inverse) of this type.

The maximum value which can be inhabited by this type.

The minimum value which can be inhabited by this type.

Creates an I256 from a sign and an absolute value. Returns the value and a bool that is true if the conversion caused an overflow.

Creates an I256 from an absolute value and a negative flag. Returns None if it would overflow an I256.

Splits a I256 into its absolute value and negative flag.

Returns the sign of self.

Coerces an unsigned integer into a signed one. If the unsigned integer is greater than the greater than or equal to 1 << 255, then the result will overflow into a negative value.

Returns the signed integer as a unsigned integer. If the value of self negative, then the two’s complement of its absolute value will be returned.

Conversion to i32

Conversion to u32

Conversion to i64

Conversion to u64

Conversion to i128

Conversion to u128

Conversion to i128

Conversion to usize

Conversion to i32 with overflow checking

Panics

Panics if the number is outside the range [i32::MIN, i32::MAX].

Conversion to u32 with overflow checking

Panics

Panics if the number is outside the range [0, u32::MAX].

Conversion to i64 with overflow checking

Panics

Panics if the number is outside the range [i64::MIN, i64::MAX].

Conversion to u64 with overflow checking

Panics

Panics if the number is outside the range [0, u64::MAX].

Conversion to i128 with overflow checking

Panics

Panics if the number is outside the range [i128::MIN, i128::MAX].

Conversion to u128 with overflow checking

Panics

Panics if the number is outside the range [0, u128::MAX].

Conversion to isize with overflow checking

Panics

Panics if the number is outside the range [isize::MIN, isize::MAX].

Conversion to usize with overflow checking

Panics

Panics if the number is outside the range [0, usize::MAX].

Convert from a decimal string.

Convert from a hexadecimal string.

Returns the sign of the number.

Returns true if self is positive and false if the number is zero or negative.

Returns true if self is negative and false if the number is zero or negative.

Returns true if self is negative and false if the number is zero or positive.

Gets the absolute value.

Panics

In debug mode, will panic if it overflows.

Computes the absolute value of self.

Returns a tuple of the absolute version of self along with a boolean indicating whether an overflow happened. If self is the minimum value (e.g., I256::MIN for values of type I256), then the minimum value will be returned again and true will be returned for an overflow happening.

Checked absolute value. Computes self.abs(), returning None if self == MIN.

Saturating absolute value. Computes self.abs(), returning MAX if self == MIN instead of overflowing.

Wrapping absolute value. Computes self.abs(), wrapping around at the boundary of the type.

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, then the minimum value will be returned again and true will be returned for an overflow happening.

Checked negation. Computes self.neg(), returning None if self == MIN.

Saturating negation. Computes self.neg(), returning MAX if self == MIN instead of overflowing.

Wrapping negation. Computes self.neg(), returning MIN if self == MIN instead of overflowing.

Return the least number of bits needed to represent the number.

Return if specific bit is set.

Panics

Panics if index exceeds the bit width of the number.

Returns the number of ones in the binary representation of self.

Returns the number of zeros in the binary representation of self.

Returns the number of leading zeros in the binary representation of self.

Returns the number of leading zeros in the binary representation of self.

Return specific byte.

Panics

Panics if index exceeds the byte width of the number.

Write to the slice in big-endian format.

Write to the slice in little-endian format.

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.

Checked addition. Returns None if overflow occurred.

Addition which saturates at the maximum value (Self::max_value()).

Wrapping addition.

Calculates self - rhs

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.

Checked subtraction. Returns None if overflow occurred.

Subtraction which saturates at zero.

Wrapping subtraction.

Calculates self * 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.

Checked multiplication. Returns None if overflow occurred.

Multiplication which saturates at the maximum value..

Wrapping multiplication.

Calculates self / rhs

Returns a tuple of the division along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.

Checked division. Returns None if overflow occurred or if rhs == 0.

Division which saturates at the maximum value.

Wrapping division.

Calculates self % rhs

Returns a tuple of the remainder along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would have occurred then the wrapped value is returned.

Checked remainder. Returns None if overflow occurred or rhs == 0

Wrapping remainder. Returns the result of the operation % regardless of whether or not the division overflowed.

Calculates the quotient of Euclidean division of self by rhs.

This computes the integer n such that self = n * rhs + self.rem_euclid(rhs), with 0 <= self.rem_euclid(rhs) < rhs. In other words, the result is self / rhs rounded to the integer n such that self >= n * rhs:

  • If self > 0, this is equal to round towards zero (the default in Rust);
  • If self < 0, this is equal to round towards +/- infinity.

Calculates the least non-negative remainder of self (mod rhs). This is done as if by the Euclidean division algorithm given r = self.rem_euclid(rhs), self = rhs * self.div_euclid(rhs) + r, and 0 <= r < abs(rhs).

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. If an overflow would occur then self is returned.

Checked Euclidean division. Computes self.div_euclid(rhs), returning None if rhs == 0 or the division results in overflow.

Wrapping Euclidean division. Computes self.div_euclid(rhs), wrapping around at the boundary of the type. Wrapping only occurs in MIN / -1 on a signed type (where MIN is the negative minimal value for the type). This is equivalent to -MIN, a positive value that is too large to represent in the type. In this case, this method returns MIN itself.

Overflowing Euclidean remainder. Calculates self.rem_euclid(rhs). 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 if rhs == 0

Wrapping Euclidean remainder. Computes self.rem_euclid(rhs), wrapping around at the boundary of the type. Wrapping will only occur in MIN % -1 on a signed type (where MIN is the negative minimal value for the type). In this case, this method returns 0. Panics when rhs == 0

Checked Euclidean remainder. Computes self.rem_euclid(rhs), returning None if rhs == 0 or the division results in overflow.

Create 10**n as this type.

Panics

Panics if the result overflows the type.

Raise self to the power of exp.

Panics

Panics if the result overflows the type in debug mode.

Raises self to the power of exp.

Returns a tuple of the exponentiation along with a bool indicating whether an overflow happened.

Raises self to the power of exp. Returns None if overflow occurred.

Raises self to the power of exp, saturating at the numeric bounds instead of overflowing.

Wrapping powolute value. Computes self.pow(), wrapping around at the boundary of the type.

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

Performs the += operation. Read more

The resulting type after applying the & operator.

Performs the & operation. Read more

Performs the &= operation. Read more

The resulting type after applying the | operator.

Performs the | operation. Read more

Performs the |= operation. Read more

The resulting type after applying the ^ operator.

Performs the ^ operation. Read more

Performs the ^= operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

Performs the /= operation. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

The associated error which can be returned from parsing.

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

Feeds this value into the given Hasher. Read more

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

Formats the value using the given formatter.

The resulting type after applying the * operator.

Performs the * operation. Read more

Performs the *= operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The resulting type after applying the ! operator.

Performs the unary ! operation. Read more

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

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

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

This method tests for !=.

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

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

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

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

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

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

The resulting type after applying the % operator.

Performs the % operation. Read more

Performs the %= operation. Read more

Serialize this value into the given Serde serializer. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

The resulting type after applying the << operator.

Performs the << operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Performs the <<= operation. Read more

Implements the logical shift right operation

The resulting type after applying the >> operator.

Performs the >> operation. Read more

Implements the logical shift right operation

The resulting type after applying the >> operator.

Performs the >> operation. Read more

Implements the logical shift right operation

The resulting type after applying the >> operator.

Performs the >> operation. Read more

Implements the logical shift right operation

The resulting type after applying the >> operator.

Performs the >> operation. Read more

Implements the logical shift right operation

The resulting type after applying the >> operator.

Performs the >> operation. Read more

Implements the logical shift right operation

The resulting type after applying the >> operator.

Performs the >> operation. Read more

Implements the logical shift right operation

The resulting type after applying the >> operator.

Performs the >> operation. Read more

Implements the logical shift right operation

The resulting type after applying the >> operator.

Performs the >> operation. Read more

Implements the logical shift right operation

The resulting type after applying the >> operator.

Performs the >> operation. Read more

Implements the logical shift right operation

The resulting type after applying the >> operator.

Performs the >> operation. Read more

Implements the logical shift right operation

The resulting type after applying the >> operator.

Performs the >> operation. Read more

Implements the logical shift right operation

The resulting type after applying the >> operator.

Performs the >> operation. Read more

Implements the logical shift right operation

The resulting type after applying the >> operator.

Performs the >> operation. Read more

Implements the logical shift right operation

The resulting type after applying the >> operator.

Performs the >> operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

Performs the >>= operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

Performs the -= operation. Read more

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

Converts a Token into expected type.

Converts a specified type back into token.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Formats the value using the given formatter.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Creates a new instance from parsed ABI tokens.

Compare self to key and return true if they are equal.

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

Convert to list of tokens

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more