logo
#[repr(C)]
pub struct U256(pub [u64; 4]);
Expand description

Little-endian large integer type

Tuple Fields

0: [u64; 4]

Implementations

Maximum value.

Converts a string slice in a given base to an integer. Only supports radixes of 10 and 16.

Convert from a decimal string.

Conversion to u32

Low word (u64)

Conversion to u32 with overflow checking

Panics

Panics if the number is larger than 2^32.

Conversion to u64 with overflow checking

Panics

Panics if the number is larger than u64::max_value().

Conversion to usize with overflow checking

Panics

Panics if the number is larger than usize::max_value().

Whether this is zero.

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 leading zeros in the binary representation of self.

Returns the number of trailing 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.

Create 10**n as this type.

Panics

Panics if the result overflows the type.

Zero (additive identity) of this type.

One (multiplicative identity) of this type.

The maximum value which can be inhabited by this type.

Returns a pair (self / other, self % other).

Panics

Panics if other is zero.

Compute the highest n such that n * n <= self.

Fast exponentiation by squaring https://en.wikipedia.org/wiki/Exponentiation_by_squaring

Panics

Panics if the result overflows the type.

Fast exponentiation by squaring. Returns result and overflow flag.

Checked exponentiation. Returns None if overflow occurred.

Add with overflow.

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

Checked addition. Returns None if overflow occurred.

Subtraction which underflows and returns a flag if it does.

Subtraction which saturates at zero.

Checked subtraction. Returns None if overflow occurred.

Multiply with overflow, returning a flag if it does.

Multiplication which saturates at the maximum value..

Checked multiplication. Returns None if overflow occurred.

Checked division. Returns None if other == 0.

Checked modulus. Returns None if other == 0.

Negation with overflow.

Checked negation. Returns None unless self == 0.

Converts from big endian representation bytes in memory.

Converts from little endian representation bytes in memory.

Low 2 words (u128)

Conversion to u128 with overflow checking

Panics

Panics if the number is larger than 2^128.

Trait Implementations

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

Convert a value to another, using the as operator.

Convert a value to another, using the as operator.

Convert a value to another, using the as operator.

Convert a value to another, using the as operator.

Convert a value to another, using the as operator.

Convert a value to another, using the as operator.

Convert a value to another, using the as operator.

Convert a value to another, using the as operator.

Convert a value to another, using the as operator.

Convert a value to another, using the as operator.

Convert a value to another, using the as operator.

Convert a value to another, using the as operator.

Convert a value to another, using the as operator.

Convert a value to another, using the as operator.

Convert a value to another, using the as operator.

Get a reference to the underlying little-endian words.

Converts this type into a shared reference of the (usually inferred) input type.

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

returns the smallest finite number this type can represent

returns the largest finite number this type can represent

The CLType of Self.

Multiplies two numbers, checking for underflow or overflow. If underflow or overflow happens, None is returned. Read more

Subtracts two numbers, checking for underflow. If underflow happens, None is returned. 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

Generate a random value of T, using rng as the source of randomness.

Create an iterator that generates random values of T, using rng as the source of randomness. Read more

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F 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

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Deserializes the slice into Self.

Deserializes the Vec<u8> into Self.

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

Unsigned integer division. Returns the same result as div (/).

Unsigned integer modulo operation. Returns the same result as rem (%).

Calculates the Greatest Common Divisor (GCD) of the number and other

Calculates the Lowest Common Multiple (LCM) of the number and other.

Calculates the Greatest Common Divisor (GCD) and Lowest Common Multiple (LCM) of the number and other.

Deprecated, use is_multiple_of instead.

Returns true if the number is a multiple of other.

Returns true if the number is divisible by 2.

Returns true if the number is not divisible by 2.

Simultaneous truncated integer division and modulus.

Ceiled integer division. Read more

Greatest common divisor and Bézout coefficients. Read more

Greatest common divisor, least common multiple, and Bézout coefficients.

Simultaneous floored integer division and modulus. Returns (quotient, remainder). Read more

Rounds up to nearest multiple of argument. Read more

Rounds down to nearest multiple of argument. Read more

Formats the value using the given formatter.

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

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

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

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

The resulting type after applying the ! operator.

Performs the unary ! operation. Read more

Convert from a string and radix (typically 2..=36). Read more

Returns the multiplicative identity element of Self, 1. Read more

Sets self to the multiplicative identity element of Self, 1.

Returns true if self is equal to the multiplicative identity. 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

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

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

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

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

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

Serializes &self to a Vec<u8>.

Returns the length of the Vec<u8> which would be returned from a successful call to to_bytes() or into_bytes(). The data is not actually serialized, so this call is relatively cheap. Read more

Consumes self and serializes to a Vec<u8>.

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.

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.

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.

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.

Wrapping (modular) addition. Computes self + other, wrapping around at the boundary of the type. Read more

Wrapping (modular) subtraction. Computes self - other, wrapping around at the boundary of the type. Read more

Returns the additive identity element of Self, 0. Read more

Returns true if self is equal to the additive identity.

Sets self to the additive identity element of Self, 0.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Views memory as a slice of immutable bits. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Converts self into a target type. Read more

Causes self to use its Binary implementation when Debug-formatted.

Causes self to use its Display implementation when Debug-formatted. Read more

Causes self to use its LowerExp implementation when Debug-formatted. Read more

Causes self to use its LowerHex implementation when Debug-formatted. Read more

Causes self to use its Octal implementation when Debug-formatted.

Causes self to use its Pointer implementation when Debug-formatted. Read more

Causes self to use its UpperExp implementation when Debug-formatted. Read more

Causes self to use its UpperHex implementation when Debug-formatted. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Pipes a value into a function that cannot ordinarily be called in suffix position. Read more

Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more

Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more

Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more

Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more

Pipes a dereference into a function that cannot normally be called in suffix position. Read more

Pipes a mutable dereference into a function that cannot normally be called in suffix position. Read more

Pipes a reference into a function that cannot ordinarily be called in suffix position. Read more

Pipes a mutable reference into a function that cannot ordinarily be called in suffix position. Read more

Should always be Self

Provides immutable access for inspection. Read more

Calls tap in debug builds, and does nothing in release builds.

Provides mutable access for modification. Read more

Calls tap_mut in debug builds, and does nothing in release builds.

Provides immutable access to the reference for inspection.

Calls tap_ref in debug builds, and does nothing in release builds.

Provides mutable access to the reference for modification.

Calls tap_ref_mut in debug builds, and does nothing in release builds.

Provides immutable access to the borrow for inspection. Read more

Calls tap_borrow in debug builds, and does nothing in release builds.

Provides mutable access to the borrow for modification.

Calls tap_borrow_mut in debug builds, and does nothing in release builds. Read more

Immutably dereferences self for inspection.

Calls tap_deref in debug builds, and does nothing in release builds.

Mutably dereferences self for modification.

Calls tap_deref_mut in debug builds, and does nothing in release builds. Read more

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

Attempts to convert self into a target type. Read more

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.