pub struct JsBigInt { /* private fields */ }
Expand description
JavaScript bigint primitive rust type.
Implementations§
Source§impl 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§
Source§impl Ord for JsBigInt
impl Ord for JsBigInt
Source§impl PartialOrd for JsBigInt
impl PartialOrd for JsBigInt
Source§impl Trace for JsBigInt
impl Trace for JsBigInt
Source§fn finalize_glue(&self)
fn finalize_glue(&self)
Runs Finalize::finalize() on this object and all
contained subobjects
impl Eq for JsBigInt
impl StructuralPartialEq for JsBigInt
Auto Trait Implementations§
impl Freeze for JsBigInt
impl RefUnwindSafe for JsBigInt
impl !Send for JsBigInt
impl !Sync for JsBigInt
impl Unpin for JsBigInt
impl UnwindSafe for JsBigInt
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.