Uint

Struct Uint 

Source
#[repr(transparent)]
pub struct Uint(pub BigInt);
Expand description

A wrapper type for arbitrary-precision unsigned integers (Uint)

Tuple Fields§

§0: BigInt

Implementations§

Source§

impl Uint

Source

pub fn from_u64(value: u64) -> Self

Create a new Uint from a u64

Source

pub fn from_u128(value: u128) -> Self

Create a new Uint from a u128

Source

pub fn zero() -> Self

Create a Uint representing zero

Source

pub fn one() -> Self

Create a Uint representing one

Methods from Deref<Target = StdBigInt>§

Source

pub const ZERO: BigInt

Source

pub fn to_bytes_be(&self) -> (Sign, Vec<u8>)

Returns the sign and the byte representation of the BigInt in big-endian byte order.

§Examples
use num_bigint::{ToBigInt, Sign};

let i = -1125.to_bigint().unwrap();
assert_eq!(i.to_bytes_be(), (Sign::Minus, vec![4, 101]));
Source

pub fn to_bytes_le(&self) -> (Sign, Vec<u8>)

Returns the sign and the byte representation of the BigInt in little-endian byte order.

§Examples
use num_bigint::{ToBigInt, Sign};

let i = -1125.to_bigint().unwrap();
assert_eq!(i.to_bytes_le(), (Sign::Minus, vec![101, 4]));
Source

pub fn to_u32_digits(&self) -> (Sign, Vec<u32>)

Returns the sign and the u32 digits representation of the BigInt ordered least significant digit first.

§Examples
use num_bigint::{BigInt, Sign};

assert_eq!(BigInt::from(-1125).to_u32_digits(), (Sign::Minus, vec![1125]));
assert_eq!(BigInt::from(4294967295u32).to_u32_digits(), (Sign::Plus, vec![4294967295]));
assert_eq!(BigInt::from(4294967296u64).to_u32_digits(), (Sign::Plus, vec![0, 1]));
assert_eq!(BigInt::from(-112500000000i64).to_u32_digits(), (Sign::Minus, vec![830850304, 26]));
assert_eq!(BigInt::from(112500000000i64).to_u32_digits(), (Sign::Plus, vec![830850304, 26]));
Source

pub fn to_u64_digits(&self) -> (Sign, Vec<u64>)

Returns the sign and the u64 digits representation of the BigInt ordered least significant digit first.

§Examples
use num_bigint::{BigInt, Sign};

assert_eq!(BigInt::from(-1125).to_u64_digits(), (Sign::Minus, vec![1125]));
assert_eq!(BigInt::from(4294967295u32).to_u64_digits(), (Sign::Plus, vec![4294967295]));
assert_eq!(BigInt::from(4294967296u64).to_u64_digits(), (Sign::Plus, vec![4294967296]));
assert_eq!(BigInt::from(-112500000000i64).to_u64_digits(), (Sign::Minus, vec![112500000000]));
assert_eq!(BigInt::from(112500000000i64).to_u64_digits(), (Sign::Plus, vec![112500000000]));
assert_eq!(BigInt::from(1u128 << 64).to_u64_digits(), (Sign::Plus, vec![0, 1]));
Source

pub fn iter_u32_digits(&self) -> U32Digits<'_>

Returns an iterator of u32 digits representation of the BigInt ordered least significant digit first.

§Examples
use num_bigint::BigInt;

assert_eq!(BigInt::from(-1125).iter_u32_digits().collect::<Vec<u32>>(), vec![1125]);
assert_eq!(BigInt::from(4294967295u32).iter_u32_digits().collect::<Vec<u32>>(), vec![4294967295]);
assert_eq!(BigInt::from(4294967296u64).iter_u32_digits().collect::<Vec<u32>>(), vec![0, 1]);
assert_eq!(BigInt::from(-112500000000i64).iter_u32_digits().collect::<Vec<u32>>(), vec![830850304, 26]);
assert_eq!(BigInt::from(112500000000i64).iter_u32_digits().collect::<Vec<u32>>(), vec![830850304, 26]);
Source

pub fn iter_u64_digits(&self) -> U64Digits<'_>

Returns an iterator of u64 digits representation of the BigInt ordered least significant digit first.

§Examples
use num_bigint::BigInt;

assert_eq!(BigInt::from(-1125).iter_u64_digits().collect::<Vec<u64>>(), vec![1125u64]);
assert_eq!(BigInt::from(4294967295u32).iter_u64_digits().collect::<Vec<u64>>(), vec![4294967295u64]);
assert_eq!(BigInt::from(4294967296u64).iter_u64_digits().collect::<Vec<u64>>(), vec![4294967296u64]);
assert_eq!(BigInt::from(-112500000000i64).iter_u64_digits().collect::<Vec<u64>>(), vec![112500000000u64]);
assert_eq!(BigInt::from(112500000000i64).iter_u64_digits().collect::<Vec<u64>>(), vec![112500000000u64]);
assert_eq!(BigInt::from(1u128 << 64).iter_u64_digits().collect::<Vec<u64>>(), vec![0, 1]);
Source

pub fn to_signed_bytes_be(&self) -> Vec<u8>

Returns the two’s-complement byte representation of the BigInt in big-endian byte order.

§Examples
use num_bigint::ToBigInt;

let i = -1125.to_bigint().unwrap();
assert_eq!(i.to_signed_bytes_be(), vec![251, 155]);
Source

pub fn to_signed_bytes_le(&self) -> Vec<u8>

Returns the two’s-complement byte representation of the BigInt in little-endian byte order.

§Examples
use num_bigint::ToBigInt;

let i = -1125.to_bigint().unwrap();
assert_eq!(i.to_signed_bytes_le(), vec![155, 251]);
Source

pub fn to_str_radix(&self, radix: u32) -> String

Returns the integer formatted as a string in the given radix. radix must be in the range 2...36.

§Examples
use num_bigint::BigInt;

let i = BigInt::parse_bytes(b"ff", 16).unwrap();
assert_eq!(i.to_str_radix(16), "ff");
Source

pub fn to_radix_be(&self, radix: u32) -> (Sign, Vec<u8>)

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.

§Examples
use num_bigint::{BigInt, Sign};

assert_eq!(BigInt::from(-0xFFFFi64).to_radix_be(159),
           (Sign::Minus, vec![2, 94, 27]));
// 0xFFFF = 65535 = 2*(159^2) + 94*159 + 27
Source

pub fn to_radix_le(&self, radix: u32) -> (Sign, Vec<u8>)

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.

§Examples
use num_bigint::{BigInt, Sign};

assert_eq!(BigInt::from(-0xFFFFi64).to_radix_le(159),
           (Sign::Minus, vec![27, 94, 2]));
// 0xFFFF = 65535 = 27 + 94*159 + 2*(159^2)
Source

pub fn sign(&self) -> Sign

Returns the sign of the BigInt as a Sign.

§Examples
use num_bigint::{BigInt, Sign};

assert_eq!(BigInt::from(1234).sign(), Sign::Plus);
assert_eq!(BigInt::from(-4321).sign(), Sign::Minus);
assert_eq!(BigInt::ZERO.sign(), Sign::NoSign);
Source

pub fn magnitude(&self) -> &BigUint

Returns the magnitude of the BigInt as a BigUint.

§Examples
use num_bigint::{BigInt, BigUint};
use num_traits::Zero;

assert_eq!(BigInt::from(1234).magnitude(), &BigUint::from(1234u32));
assert_eq!(BigInt::from(-4321).magnitude(), &BigUint::from(4321u32));
assert!(BigInt::ZERO.magnitude().is_zero());
Source

pub fn bits(&self) -> u64

Determines the fewest bits necessary to express the BigInt, not including the sign.

Source

pub fn to_biguint(&self) -> Option<BigUint>

Converts this BigInt into a BigUint, if it’s not negative.

Source

pub fn checked_add(&self, v: &BigInt) -> Option<BigInt>

Source

pub fn checked_sub(&self, v: &BigInt) -> Option<BigInt>

Source

pub fn checked_mul(&self, v: &BigInt) -> Option<BigInt>

Source

pub fn checked_div(&self, v: &BigInt) -> Option<BigInt>

Source

pub fn pow(&self, exponent: u32) -> BigInt

Returns self ^ exponent.

Source

pub fn modpow(&self, exponent: &BigInt, modulus: &BigInt) -> BigInt

Returns (self ^ exponent) mod modulus

Note that this rounds like mod_floor, not like the % operator, which makes a difference when given a negative self or modulus. The result will be in the interval [0, modulus) for modulus > 0, or in the interval (modulus, 0] for modulus < 0

Panics if the exponent is negative or the modulus is zero.

Source

pub fn modinv(&self, modulus: &BigInt) -> Option<BigInt>

Returns the modular multiplicative inverse if it exists, otherwise None.

This solves for x such that self * x ≡ 1 (mod modulus). Note that this rounds like mod_floor, not like the % operator, which makes a difference when given a negative self or modulus. The solution will be in the interval [0, modulus) for modulus > 0, or in the interval (modulus, 0] for modulus < 0, and it exists if and only if gcd(self, modulus) == 1.

use num_bigint::BigInt;
use num_integer::Integer;
use num_traits::{One, Zero};

let m = BigInt::from(383);

// Trivial cases
assert_eq!(BigInt::zero().modinv(&m), None);
assert_eq!(BigInt::one().modinv(&m), Some(BigInt::one()));
let neg1 = &m - 1u32;
assert_eq!(neg1.modinv(&m), Some(neg1));

// Positive self and modulus
let a = BigInt::from(271);
let x = a.modinv(&m).unwrap();
assert_eq!(x, BigInt::from(106));
assert_eq!(x.modinv(&m).unwrap(), a);
assert_eq!((&a * x).mod_floor(&m), BigInt::one());

// Negative self and positive modulus
let b = -&a;
let x = b.modinv(&m).unwrap();
assert_eq!(x, BigInt::from(277));
assert_eq!((&b * x).mod_floor(&m), BigInt::one());

// Positive self and negative modulus
let n = -&m;
let x = a.modinv(&n).unwrap();
assert_eq!(x, BigInt::from(-277));
assert_eq!((&a * x).mod_floor(&n), &n + 1);

// Negative self and modulus
let x = b.modinv(&n).unwrap();
assert_eq!(x, BigInt::from(-106));
assert_eq!((&b * x).mod_floor(&n), &n + 1);
Source

pub fn sqrt(&self) -> BigInt

Returns the truncated principal square root of self – see num_integer::Roots::sqrt().

Source

pub fn cbrt(&self) -> BigInt

Returns the truncated principal cube root of self – see num_integer::Roots::cbrt().

Source

pub fn nth_root(&self, n: u32) -> BigInt

Returns the truncated principal nth root of self – See num_integer::Roots::nth_root().

Source

pub fn trailing_zeros(&self) -> Option<u64>

Returns the number of least-significant bits that are zero, or None if the entire number is zero.

Source

pub fn bit(&self, bit: u64) -> bool

Returns whether the bit in position bit is set, using the two’s complement for negative numbers

Trait Implementations§

Source§

impl Clone for Uint

Source§

fn clone(&self) -> Uint

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Uint

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Uint

Source§

fn default() -> Self

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

impl Deref for Uint

Source§

type Target = BigInt

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'de> Deserialize<'de> for Uint

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Uint

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<BigInt> for Uint

Source§

fn from(value: StdBigInt) -> Self

Converts to this type from the input type.
Source§

impl From<Uint> for BigInt

Source§

fn from(uint: Uint) -> Self

Converts to this type from the input type.
Source§

impl From<Uint> for Decimal

Source§

fn from(value: Uint) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for Uint

Source§

fn from(value: i128) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Uint

Source§

fn from(value: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Uint

Source§

fn from(value: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Uint

Source§

fn from(value: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Uint

Source§

fn from(value: i8) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for Uint

Source§

fn from(value: u128) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Uint

Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Uint

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Uint

Source§

fn from(value: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Uint

Source§

fn from(value: u8) -> Self

Converts to this type from the input type.
Source§

impl GetType for Uint

Source§

impl Hash for Uint

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

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

impl Ord for Uint

Source§

fn cmp(&self, other: &Self) -> Ordering

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

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Uint

Source§

fn eq(&self, other: &Uint) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Uint

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Promote<Decimal> for Uint

Source§

type Output = Decimal

Source§

fn checked_promote(&self, r: &Decimal) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Decimal) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Decimal) -> (Self::Output, Self::Output)

Source§

impl Promote<Int> for Uint

Source§

type Output = Int

Source§

fn checked_promote(&self, r: &Int) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Int) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Int) -> (Self::Output, Self::Output)

Source§

impl Promote<Uint> for Decimal

Source§

type Output = Decimal

Source§

fn checked_promote(&self, r: &Uint) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

impl Promote<Uint> for Int

Source§

type Output = Int

Source§

fn checked_promote(&self, r: &Uint) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

impl Promote<Uint> for Uint

Source§

type Output = Uint

Source§

fn checked_promote(&self, r: &Uint) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

impl Promote<Uint> for f32

Source§

type Output = Decimal

Source§

fn checked_promote(&self, r: &Uint) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

impl Promote<Uint> for f64

Source§

type Output = Decimal

Source§

fn checked_promote(&self, r: &Uint) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

impl Promote<Uint> for i128

Source§

type Output = Int

Source§

fn checked_promote(&self, r: &Uint) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

impl Promote<Uint> for i16

Source§

type Output = Int

Source§

fn checked_promote(&self, r: &Uint) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

impl Promote<Uint> for i32

Source§

type Output = Int

Source§

fn checked_promote(&self, r: &Uint) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

impl Promote<Uint> for i64

Source§

type Output = Int

Source§

fn checked_promote(&self, r: &Uint) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

impl Promote<Uint> for i8

Source§

type Output = Int

Source§

fn checked_promote(&self, r: &Uint) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

impl Promote<Uint> for u128

Source§

type Output = Uint

Source§

fn checked_promote(&self, r: &Uint) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

impl Promote<Uint> for u16

Source§

type Output = Uint

Source§

fn checked_promote(&self, r: &Uint) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

impl Promote<Uint> for u32

Source§

type Output = Uint

Source§

fn checked_promote(&self, r: &Uint) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

impl Promote<Uint> for u64

Source§

type Output = Uint

Source§

fn checked_promote(&self, r: &Uint) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

impl Promote<Uint> for u8

Source§

type Output = Uint

Source§

fn checked_promote(&self, r: &Uint) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &Uint) -> (Self::Output, Self::Output)

Source§

impl Promote<f32> for Uint

Source§

type Output = Decimal

Source§

fn checked_promote(&self, r: &f32) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &f32) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &f32) -> (Self::Output, Self::Output)

Source§

impl Promote<f64> for Uint

Source§

type Output = Decimal

Source§

fn checked_promote(&self, r: &f64) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &f64) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &f64) -> (Self::Output, Self::Output)

Source§

impl Promote<i128> for Uint

Source§

type Output = Int

Source§

fn checked_promote(&self, r: &i128) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &i128) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &i128) -> (Self::Output, Self::Output)

Source§

impl Promote<i16> for Uint

Source§

type Output = Int

Source§

fn checked_promote(&self, r: &i16) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &i16) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &i16) -> (Self::Output, Self::Output)

Source§

impl Promote<i32> for Uint

Source§

type Output = Int

Source§

fn checked_promote(&self, r: &i32) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &i32) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &i32) -> (Self::Output, Self::Output)

Source§

impl Promote<i64> for Uint

Source§

type Output = Int

Source§

fn checked_promote(&self, r: &i64) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &i64) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &i64) -> (Self::Output, Self::Output)

Source§

impl Promote<i8> for Uint

Source§

type Output = Int

Source§

fn checked_promote(&self, r: &i8) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &i8) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &i8) -> (Self::Output, Self::Output)

Source§

impl Promote<u128> for Uint

Source§

type Output = Uint

Source§

fn checked_promote(&self, r: &u128) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &u128) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &u128) -> (Self::Output, Self::Output)

Source§

impl Promote<u16> for Uint

Source§

type Output = Uint

Source§

fn checked_promote(&self, r: &u16) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &u16) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &u16) -> (Self::Output, Self::Output)

Source§

impl Promote<u32> for Uint

Source§

type Output = Uint

Source§

fn checked_promote(&self, r: &u32) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &u32) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &u32) -> (Self::Output, Self::Output)

Source§

impl Promote<u64> for Uint

Source§

type Output = Uint

Source§

fn checked_promote(&self, r: &u64) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &u64) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &u64) -> (Self::Output, Self::Output)

Source§

impl Promote<u8> for Uint

Source§

type Output = Uint

Source§

fn checked_promote(&self, r: &u8) -> Option<(Self::Output, Self::Output)>

Source§

fn saturating_promote(&self, r: &u8) -> (Self::Output, Self::Output)

Source§

fn wrapping_promote(&self, r: &u8) -> (Self::Output, Self::Output)

Source§

impl SafeAdd for Uint

Source§

fn checked_add(&self, r: &Self) -> Option<Self>

Source§

fn saturating_add(&self, r: &Self) -> Self

Source§

fn wrapping_add(&self, r: &Self) -> Self

Source§

impl SafeConvert<Decimal> for Uint

Source§

impl SafeConvert<Int> for Uint

Source§

impl SafeConvert<Uint> for Decimal

Source§

impl SafeConvert<Uint> for Int

Source§

impl SafeConvert<Uint> for Uint

Source§

impl SafeConvert<Uint> for f32

Source§

impl SafeConvert<Uint> for f64

Source§

impl SafeConvert<Uint> for i128

Source§

impl SafeConvert<Uint> for i16

Source§

impl SafeConvert<Uint> for i32

Source§

impl SafeConvert<Uint> for i64

Source§

impl SafeConvert<Uint> for i8

Source§

impl SafeConvert<Uint> for u128

Source§

impl SafeConvert<Uint> for u16

Source§

impl SafeConvert<Uint> for u32

Source§

impl SafeConvert<Uint> for u64

Source§

impl SafeConvert<Uint> for u8

Source§

impl SafeConvert<f32> for Uint

Source§

impl SafeConvert<f64> for Uint

Source§

impl SafeConvert<i128> for Uint

Source§

impl SafeConvert<i16> for Uint

Source§

impl SafeConvert<i32> for Uint

Source§

impl SafeConvert<i64> for Uint

Source§

impl SafeConvert<i8> for Uint

Source§

impl SafeConvert<u128> for Uint

Source§

impl SafeConvert<u16> for Uint

Source§

impl SafeConvert<u32> for Uint

Source§

impl SafeConvert<u64> for Uint

Source§

impl SafeConvert<u8> for Uint

Source§

impl SafeDiv for Uint

Source§

fn checked_div(&self, r: &Self) -> Option<Self>

Source§

fn saturating_div(&self, r: &Self) -> Self

Source§

fn wrapping_div(&self, r: &Self) -> Self

Source§

impl SafeMul for Uint

Source§

fn checked_mul(&self, r: &Self) -> Option<Self>

Source§

fn saturating_mul(&self, r: &Self) -> Self

Source§

fn wrapping_mul(&self, r: &Self) -> Self

Source§

impl SafeRemainder for Uint

Source§

fn checked_rem(&self, r: &Self) -> Option<Self>

Source§

fn saturating_rem(&self, r: &Self) -> Self

Source§

fn wrapping_rem(&self, r: &Self) -> Self

Source§

impl SafeSub for Uint

Source§

fn checked_sub(&self, r: &Self) -> Option<Self>

Source§

fn saturating_sub(&self, r: &Self) -> Self

Source§

fn wrapping_sub(&self, r: &Self) -> Self

Source§

impl Serialize for Uint

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFromValue for Uint

Source§

fn try_from_value(value: &Value) -> Result<Self, FromValueError>

Attempt to extract a value of this type from a Value. Read more
Source§

fn from_value(value: &Value) -> Option<Self>

Extract from Value, returning None for Undefined or type mismatch. Read more
Source§

impl Eq for Uint

Source§

impl IsNumber for Uint

Source§

impl IsUint for Uint

Source§

impl StructuralPartialEq for Uint

Auto Trait Implementations§

§

impl Freeze for Uint

§

impl RefUnwindSafe for Uint

§

impl Send for Uint

§

impl Sync for Uint

§

impl Unpin for Uint

§

impl UnwindSafe for Uint

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,