Struct soroban_sdk::BigInt
source · [−]#[repr(transparent)]pub struct BigInt(_);
Expand description
BigInt is an arbitrary sized signed integer.
Examples
use soroban_sdk::{BigInt, Env};
let env = Env::default();
let b1 = BigInt::from_u64(&env, u64::MAX);
let b2 = b1 * 3;
let b3 = b2 / 4;
assert_eq!(b3, 13_835_058_055_282_163_711u64)
Implementations
sourceimpl BigInt
impl BigInt
sourcepub fn gcd(&self, other: BigInt) -> BigInt
pub fn gcd(&self, other: BigInt) -> BigInt
Returns the greatest common divisor of the BigInt and other.
sourcepub fn lcm(&self, other: BigInt) -> BigInt
pub fn lcm(&self, other: BigInt) -> BigInt
Returns the lowest common multiple of the BigInt and other.
Trait Implementations
sourceimpl Ord for BigInt
impl Ord for BigInt
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<BigInt> for BigInt
impl PartialOrd<BigInt> for BigInt
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
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 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<i32> for BigInt
impl PartialOrd<i32> for BigInt
sourcefn partial_cmp(&self, other: &i32) -> Option<Ordering>
fn partial_cmp(&self, other: &i32) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<i64> for BigInt
impl PartialOrd<i64> for BigInt
sourcefn partial_cmp(&self, other: &i64) -> Option<Ordering>
fn partial_cmp(&self, other: &i64) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<u32> for BigInt
impl PartialOrd<u32> for BigInt
sourcefn partial_cmp(&self, other: &u32) -> Option<Ordering>
fn partial_cmp(&self, other: &u32) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl PartialOrd<u64> for BigInt
impl PartialOrd<u64> for BigInt
sourcefn partial_cmp(&self, other: &u64) -> Option<Ordering>
fn partial_cmp(&self, other: &u64) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl TryIntoVal<Env, BigInt> for RawVal
impl TryIntoVal<Env, BigInt> for RawVal
type Error = ConversionError
fn try_into_val(self, env: &Env) -> Result<BigInt, Self::Error>
fn try_into_env_val(self, env: &E) -> Result<EnvVal<E, V>, Self::Error>
sourceimpl TryIntoVal<Env, BigInt> for ScVal
impl TryIntoVal<Env, BigInt> for ScVal
type Error = ConversionError
fn try_into_val(self, env: &Env) -> Result<BigInt, Self::Error>
fn try_into_env_val(self, env: &E) -> Result<EnvVal<E, V>, Self::Error>
impl Eq for BigInt
Auto Trait Implementations
impl !RefUnwindSafe for BigInt
impl !Send for BigInt
impl !Sync for BigInt
impl Unpin for BigInt
impl !UnwindSafe for BigInt
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more