Struct napi_h::bindgen_prelude::BigInt
source · pub struct BigInt {
pub sign_bit: bool,
pub words: Vec<u64>,
}
Expand description
https://nodejs.org/api/n-api.html#napi_create_bigint_words The resulting BigInt is calculated as: (–1)^sign_bit (words[0] × (2^64)^0 + words[1] × (2^64)^1 + …)
Fields§
§sign_bit: bool
true for negative numbers
words: Vec<u64>
Implementations§
source§impl BigInt
impl BigInt
sourcepub fn get_u64(&self) -> (bool, u64, bool)
pub fn get_u64(&self) -> (bool, u64, bool)
(signed, value, lossless)
get the first word of the BigInt as u64
return true in the last element of tuple if the value is lossless
or the value is truncated
sourcepub fn get_i64(&self) -> (i64, bool)
pub fn get_i64(&self) -> (i64, bool)
(value, lossless)
get the first word of the BigInt as i64
return true if the value is lossless
or the value is truncated
Trait Implementations§
source§impl FromNapiValue for BigInt
impl FromNapiValue for BigInt
source§unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
Safety Read more
fn from_unknown(value: JsUnknown) -> Result<Self>
source§impl ToNapiValue for BigInt
impl ToNapiValue for BigInt
source§unsafe fn to_napi_value(env: napi_env, val: Self) -> Result<napi_value>
unsafe fn to_napi_value(env: napi_env, val: Self) -> Result<napi_value>
Safety Read more
source§impl ValidateNapiValue for BigInt
impl ValidateNapiValue for BigInt
source§unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
Safety Read more
Auto Trait Implementations§
impl Freeze for BigInt
impl RefUnwindSafe for BigInt
impl Send for BigInt
impl Sync for BigInt
impl Unpin for BigInt
impl UnwindSafe for BigInt
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