pub struct JsBigInt { /* private fields */ }
Expand description
JavaScript bigint primitive rust type.
Implementations
sourceimpl JsBigInt
impl JsBigInt
sourcepub fn to_string_radix(&self, radix: u32) -> String
pub fn to_string_radix(&self, radix: u32) -> String
Convert bigint to string with radix.
sourcepub fn to_f64(&self) -> f64
pub fn to_f64(&self) -> f64
Converts the BigInt to a f64 type.
Returns f64::INFINITY
if the BigInt is too big.
sourcepub fn from_string_radix(buf: &str, radix: u32) -> Option<Self>
pub fn from_string_radix(buf: &str, radix: u32) -> Option<Self>
Converts a string to a BigInt with the specified radix.
sourcepub fn from_string(string: &str) -> Option<Self>
pub fn from_string(string: &str) -> Option<Self>
This function takes a string and conversts it to BigInt type.
More information:
sourcepub fn same_value_zero(x: &Self, y: &Self) -> bool
pub fn same_value_zero(x: &Self, y: &Self) -> bool
sourcepub fn same_value(x: &Self, y: &Self) -> bool
pub fn same_value(x: &Self, y: &Self) -> bool
sourcepub fn equal(x: &Self, y: &Self) -> bool
pub fn equal(x: &Self, y: &Self) -> bool
Checks for mathematical equality.
The abstract operation BigInt::equal takes arguments x (a BigInt
) and y (a BigInt
).
It returns true
if x and y have the same mathematical integer value and false otherwise.
More information:
pub fn pow(x: &Self, y: &Self, context: &mut Context) -> Result<Self, JsValue>
pub fn shift_right(
x: &Self,
y: &Self,
context: &mut Context
) -> Result<Self, JsValue>
pub fn shift_left(
x: &Self,
y: &Self,
context: &mut Context
) -> Result<Self, JsValue>
sourcepub fn mod_floor(x: &Self, y: &Self) -> Self
pub fn mod_floor(x: &Self, y: &Self) -> Self
Floored integer modulo.
Examples
assert_eq!((8).mod_floor(&3), 2);
assert_eq!((8).mod_floor(&-3), -1);
pub fn add(x: &Self, y: &Self) -> Self
pub fn sub(x: &Self, y: &Self) -> Self
pub fn mul(x: &Self, y: &Self) -> Self
pub fn div(x: &Self, y: &Self) -> Self
pub fn rem(x: &Self, y: &Self) -> Self
pub fn bitand(x: &Self, y: &Self) -> Self
pub fn bitor(x: &Self, y: &Self) -> Self
pub fn bitxor(x: &Self, y: &Self) -> Self
pub fn neg(x: &Self) -> Self
pub fn not(x: &Self) -> Self
Trait Implementations
sourceimpl Ord for JsBigInt
impl Ord for JsBigInt
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) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<JsBigInt> for JsBigInt
impl PartialOrd<JsBigInt> for JsBigInt
sourcefn partial_cmp(&self, other: &JsBigInt) -> Option<Ordering>
fn partial_cmp(&self, other: &JsBigInt) -> Option<Ordering>
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 moresourceimpl Trace for JsBigInt
impl Trace for JsBigInt
sourcefn finalize_glue(&self)
fn finalize_glue(&self)
Runs Finalize::finalize() on this object and all
contained subobjects Read more
impl Eq for JsBigInt
impl StructuralEq for JsBigInt
impl StructuralPartialEq for JsBigInt
Auto Trait Implementations
impl RefUnwindSafe for JsBigInt
impl !Send for JsBigInt
impl !Sync for JsBigInt
impl Unpin for JsBigInt
impl UnwindSafe for JsBigInt
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.