Enum Int

Source
pub enum Int {
    I64(i64),
    BigInt(BigInt),
}
Expand description

Container for either an integer that can fit in a 64-bit word or an arbitrarily sized BigInt.

See IntAccess for common operations.

Variants§

§

I64(i64)

§

BigInt(BigInt)

Trait Implementations§

Source§

impl Add for Int

Source§

type Output = Int

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl Clone for Int

Source§

fn clone(&self) -> Int

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Int

Source§

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

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

impl Display for Int

Source§

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

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

impl From<BigInt> for Int

Source§

fn from(value: BigInt) -> Self

Converts to this type from the input type.
Source§

impl From<BigUint> for Int

Source§

fn from(value: BigUint) -> Self

Converts to this type from the input type.
Source§

impl From<DecodedInt> for Int

Source§

fn from(uint: DecodedInt) -> Self

Note that if the DecodedInt represents -0, converting it to an Integer will result in a 0. If negative zero is significant to your use case, check it using DecodedInt::is_negative_zero before converting it to an Integer.

Source§

impl From<DecodedUInt> for Int

Source§

fn from(uint: DecodedUInt) -> Self

Converts to this type from the input type.
Source§

impl From<Int> for UInt

Source§

fn from(value: Int) -> Self

Converts to this type from the input type.
Source§

impl From<Int> for Value

Source§

fn from(integer_val: Int) -> Self

Converts to this type from the input type.
Source§

impl From<UInt> for Int

Source§

fn from(value: UInt) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Int

Source§

fn from(value: i16) -> Int

Converts to this type from the input type.
Source§

impl From<i32> for Int

Source§

fn from(value: i32) -> Int

Converts to this type from the input type.
Source§

impl From<i64> for Int

Source§

fn from(value: i64) -> Int

Converts to this type from the input type.
Source§

impl From<i8> for Int

Source§

fn from(value: i8) -> Int

Converts to this type from the input type.
Source§

impl From<isize> for Int

Source§

fn from(value: isize) -> Int

Converts to this type from the input type.
Source§

impl From<u16> for Int

Source§

fn from(value: u16) -> Int

Converts to this type from the input type.
Source§

impl From<u32> for Int

Source§

fn from(value: u32) -> Int

Converts to this type from the input type.
Source§

impl From<u64> for Int

Source§

fn from(value: u64) -> Int

Converts to this type from the input type.
Source§

impl From<u8> for Int

Source§

fn from(value: u8) -> Int

Converts to this type from the input type.
Source§

impl From<usize> for Int

Source§

fn from(value: usize) -> Int

Converts to this type from the input type.
Source§

impl IntAccess for Int

Source§

fn as_i64(&self) -> Option<i64>

Returns the value as an i64 if it can be represented as such. Read more
Source§

fn as_big_int(&self) -> Option<&BigInt>

Returns a reference as a BigInt if it is represented as such. Note that this method may return None if the underlying representation is not stored in a BigInt such as if it is represented as an i64 so it is somewhat asymmetric with respect to IntAccess::as_i64. Read more
Source§

impl Neg for Int

Source§

type Output = Int

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Ord for Int

Source§

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

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

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

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

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

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

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

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

impl PartialEq for Int

Source§

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

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

const 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 Int

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 · Source§

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

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

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 · Source§

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

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

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 Zero for Int

Source§

fn zero() -> Self

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

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

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

impl Eq for Int

Auto Trait Implementations§

§

impl Freeze for Int

§

impl RefUnwindSafe for Int

§

impl Send for Int

§

impl Sync for Int

§

impl Unpin for Int

§

impl UnwindSafe for Int

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<V> IntoAnnotatedElement for V
where V: Into<Value>,

Source§

fn with_annotations<I: IntoAnnotations>(self, annotations: I) -> Element

Converts the value into an Element with the specified annotations.
Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

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

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

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

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.