JsNumber

Struct JsNumber 

Source
pub struct JsNumber<'env>(/* private fields */);

Implementations§

Source§

impl JsNumber<'_>

Source

pub fn get_uint32(&self) -> Result<u32>

Source

pub fn get_int32(&self) -> Result<i32>

Source

pub fn get_int64(&self) -> Result<i64>

Source

pub fn get_double(&self) -> Result<f64>

Trait Implementations§

Source§

impl<'env> Clone for JsNumber<'env>

Source§

fn clone(&self) -> JsNumber<'env>

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

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

Performs copy-assignment from source. Read more
Source§

impl FromNapiValue for JsNumber<'_>

Source§

unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>

Safety Read more
Source§

fn from_unknown(value: Unknown<'_>) -> Result<Self>

Source§

impl<'env> JsValue<'env> for JsNumber<'env>

Source§

fn value(&self) -> Value

Source§

fn raw(&self) -> napi_value

Source§

fn to_unknown(&self) -> Unknown<'env>

Convert the value to an unknown
Source§

fn coerce_to_bool(&self) -> Result<bool>

Coerce the value to a boolean
Source§

fn coerce_to_number(&self) -> Result<JsNumber<'_>>

Source§

fn coerce_to_string(&self) -> Result<JsString<'_>>

Source§

fn coerce_to_object(&self) -> Result<Object<'env>>

Source§

fn is_date(&self) -> Result<bool>

Source§

fn is_promise(&self) -> Result<bool>

Source§

fn is_error(&self) -> Result<bool>

Source§

fn is_typedarray(&self) -> Result<bool>

Source§

fn is_dataview(&self) -> Result<bool>

Source§

fn is_array(&self) -> Result<bool>

Source§

fn is_buffer(&self) -> Result<bool>

Source§

fn is_arraybuffer(&self) -> Result<bool>

Source§

fn instanceof<'c, Constructor>(&self, constructor: Constructor) -> Result<bool>
where Constructor: JsValue<'c>,

Source§

fn escape<'scope, E: JsValue<'scope> + FromNapiValue>( &self, escapable_handle_scope: EscapableHandleScope<'scope>, ) -> Result<E>

Source§

impl TryFrom<JsNumber<'_>> for f64

Source§

type Error = Error

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

fn try_from(value: JsNumber<'_>) -> Result<f64>

Performs the conversion.
Source§

impl TryFrom<JsNumber<'_>> for i32

Source§

type Error = Error

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

fn try_from(value: JsNumber<'_>) -> Result<i32>

Performs the conversion.
Source§

impl TryFrom<JsNumber<'_>> for i64

Source§

type Error = Error

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

fn try_from(value: JsNumber<'_>) -> Result<i64>

Performs the conversion.
Source§

impl TryFrom<JsNumber<'_>> for u32

Source§

type Error = Error

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

fn try_from(value: JsNumber<'_>) -> Result<u32>

Performs the conversion.
Source§

impl TypeName for JsNumber<'_>

Source§

impl ValidateNapiValue for JsNumber<'_>

Source§

unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>

Safety Read more
Source§

impl<'env> Copy for JsNumber<'env>

Auto Trait Implementations§

§

impl<'env> Freeze for JsNumber<'env>

§

impl<'env> RefUnwindSafe for JsNumber<'env>

§

impl<'env> !Send for JsNumber<'env>

§

impl<'env> !Sync for JsNumber<'env>

§

impl<'env> Unpin for JsNumber<'env>

§

impl<'env> UnwindSafe for JsNumber<'env>

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<'env, T> JsValuesTuple for T
where T: JsValue<'env>,

Source§

impl<T> JsValuesTupleIntoVec for T
where T: ToNapiValue,

Source§

impl<'env, T> ToNapiValue for T
where T: JsValue<'env>,

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, 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.