Converts value to a signed 256 bit integer
Returns the byte representation of the BigUint
in big-endian byte order.
use num_bigint::BigUint;
let i = BigUint::parse_bytes(b"1125", 10).unwrap();
assert_eq!(i.to_bytes_be(), vec![4, 101]);
Returns the byte representation of the BigUint
in little-endian byte order.
use num_bigint::BigUint;
let i = BigUint::parse_bytes(b"1125", 10).unwrap();
assert_eq!(i.to_bytes_le(), vec![101, 4]);
Returns the integer formatted as a string in the given radix.
radix
must be in the range 2...36
.
use num_bigint::BigUint;
let i = BigUint::parse_bytes(b"ff", 16).unwrap();
assert_eq!(i.to_str_radix(16), "ff");
Returns the integer in the requested base in big-endian digit order.
The output is not given in a human readable alphabet but as a zero
based u8 number.
radix
must be in the range 2...256
.
use num_bigint::BigUint;
assert_eq!(BigUint::from(0xFFFFu64).to_radix_be(159),
vec![2, 94, 27]);
Returns the integer in the requested base in little-endian digit order.
The output is not given in a human readable alphabet but as a zero
based u8 number.
radix
must be in the range 2...256
.
use num_bigint::BigUint;
assert_eq!(BigUint::from(0xFFFFu64).to_radix_le(159),
vec![27, 94, 2]);
Determines the fewest bits necessary to express the BigUint
.
Returns (self ^ exponent) % modulus
.
Panics if the modulus is zero.
Returns the truncated principal square root of self
--
see Roots::sqrt
Returns the truncated principal cube root of self
--
see Roots::cbrt.
Performs copy-assignment from source
. Read more
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
Returns the "default value" for a type. 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
. Read more
fn max(self, other: Self) -> Self | 1.21.0 [src] |
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self | 1.21.0 [src] |
Compares and returns the minimum of two values. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The resulting type after applying the +
operator.
Performs the +
operation.
The resulting type after applying the -
operator.
Performs the -
operation.
The resulting type after applying the *
operator.
Performs the *
operation.
The resulting type after applying the /
operator.
Performs the /
operation.
Performs the +=
operation.
Performs the -=
operation.
Performs the *=
operation.
Performs the /=
operation.
The resulting type after dereferencing.
Feeds this value into the given [Hasher
]. Read more
Feeds a slice of this type into the given [Hasher
]. Read more
The associated error which can be returned from parsing.
Parses a string s
to return a value of this type. Read more
Formats the value using the given formatter.
Formats the value using the given formatter.
Multiplies two numbers, checking for underflow or overflow. If underflow or overflow happens, None
is returned. Read more
Converts the value of self
to an i64
.
Converts the value of self
to an u64
.
Converts the value of self
to an isize
.
Converts the value of self
to an i8
.
Converts the value of self
to an i16
.
Converts the value of self
to an i32
.
Converts the value of self
to a usize
.
Converts the value of self
to an u8
.
Converts the value of self
to an u16
.
Converts the value of self
to an u32
.
Converts the value of self
to an f32
.
Converts the value of self
to an f64
.
Converts the value of self
to an i128
. Read more
Converts the value of self
to an u128
. Read more
returns the smallest finite number this type can represent
returns the largest finite number this type can represent
Divides two numbers, checking for underflow, overflow and division by zero. If any of that happens, None
is returned. Read more
Subtracts two numbers, checking for underflow. If underflow happens, None
is returned. Read more
Adds two numbers, checking for overflow. If overflow happens, None
is returned. Read more
Convert an i64
to return an optional value of this type. If the type cannot be represented by this value, then None
is returned. Read more
Convert an u64
to return an optional value of this type. If the type cannot be represented by this value, then None
is returned. Read more
Convert an isize
to return an optional value of this type. If the value cannot be represented by this value, then None
is returned. Read more
Convert an i8
to return an optional value of this type. If the type cannot be represented by this value, then None
is returned. Read more
Convert an i16
to return an optional value of this type. If the type cannot be represented by this value, then None
is returned. Read more
Convert an i32
to return an optional value of this type. If the type cannot be represented by this value, then None
is returned. Read more
Convert a usize
to return an optional value of this type. If the type cannot be represented by this value, then None
is returned. Read more
Convert an u8
to return an optional value of this type. If the type cannot be represented by this value, then None
is returned. Read more
Convert an u16
to return an optional value of this type. If the type cannot be represented by this value, then None
is returned. Read more
Convert an u32
to return an optional value of this type. If the type cannot be represented by this value, then None
is returned. Read more
Convert a f32
to return an optional value of this type. If the type cannot be represented by this value, then None
is returned. Read more
Convert a f64
to return an optional value of this type. If the type cannot be represented by this value, then None
is returned. Read more
Convert an i128
to return an optional value of this type. If the type cannot be represented by this value, then None
is returned. Read more
Convert an u128
to return an optional value of this type. If the type cannot be represented by this value, then None
is returned. Read more
Returns the additive identity element of Self
, 0
. Read more
Returns true
if self
is equal to the additive identity.
Serialize this value into the given Serde serializer. Read more
Deserialize this value from the given Serde deserializer. Read more
Converts the given value to a String
. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static