pub trait JSValue<'a>: Sized {
    fn convert_to_rust(
        env: &'a JsEnv,
        js_value: *mut napi_value__
    ) -> Result<Self, NjError>; fn label() -> &'static str { ... } }
Expand description

Convert napi value to Rust value

Required Methods§

source

fn convert_to_rust(
    env: &'a JsEnv,
    js_value: *mut napi_value__
) -> Result<Self, NjError>

Provided Methods§

source

fn label() -> &'static str

Implementations on Foreign Types§

source§

impl<'a, T0, T1, T2, T3, T4, T5, T6> JSValue<'a> for (T0, T1, T2, T3, T4, T5, T6)where
    T0: JSValue<'a> + Send,
    T1: JSValue<'a> + Send,
    T2: JSValue<'a> + Send,
    T3: JSValue<'a> + Send,
    T4: JSValue<'a> + Send,
    T5: JSValue<'a> + Send,
    T6: JSValue<'a> + Send,

source§

impl JSValue<'_> for bool

source§

fn convert_to_rust(
    env: &JsEnv,
    js_value: *mut napi_value__
) -> Result<bool, NjError>

source§

impl<'a, T0, T1, T2, T3, T4> JSValue<'a> for (T0, T1, T2, T3, T4)where
    T0: JSValue<'a> + Send,
    T1: JSValue<'a> + Send,
    T2: JSValue<'a> + Send,
    T3: JSValue<'a> + Send,
    T4: JSValue<'a> + Send,

source§

impl<'a, T0, T1, T2, T3> JSValue<'a> for (T0, T1, T2, T3)where
    T0: JSValue<'a> + Send,
    T1: JSValue<'a> + Send,
    T2: JSValue<'a> + Send,
    T3: JSValue<'a> + Send,

source§

impl JSValue<'_> for i64

source§

fn convert_to_rust(
    env: &JsEnv,
    js_value: *mut napi_value__
) -> Result<i64, NjError>

source§

impl<'a, T0> JSValue<'a> for (T0,)where
    T0: JSValue<'a> + Send,

source§

fn convert_to_rust(
    env: &'a JsEnv,
    js_value: *mut napi_value__
) -> Result<(T0,), NjError>

source§

impl JSValue<'_> for i32

source§

fn convert_to_rust(
    env: &JsEnv,
    js_value: *mut napi_value__
) -> Result<i32, NjError>

source§

impl JSValue<'_> for u32

source§

fn convert_to_rust(
    env: &JsEnv,
    js_value: *mut napi_value__
) -> Result<u32, NjError>

source§

impl<'a, T0, T1, T2, T3, T4, T5, T6, T7> JSValue<'a> for (T0, T1, T2, T3, T4, T5, T6, T7)where
    T0: JSValue<'a> + Send,
    T1: JSValue<'a> + Send,
    T2: JSValue<'a> + Send,
    T3: JSValue<'a> + Send,
    T4: JSValue<'a> + Send,
    T5: JSValue<'a> + Send,
    T6: JSValue<'a> + Send,
    T7: JSValue<'a> + Send,

source§

impl<'a, T0, T1, T2, T3, T4, T5> JSValue<'a> for (T0, T1, T2, T3, T4, T5)where
    T0: JSValue<'a> + Send,
    T1: JSValue<'a> + Send,
    T2: JSValue<'a> + Send,
    T3: JSValue<'a> + Send,
    T4: JSValue<'a> + Send,
    T5: JSValue<'a> + Send,

source§

impl<'a, T> JSValue<'a> for Vec<T, Global>where
    T: JSValue<'a>,

source§

fn convert_to_rust(
    env: &'a JsEnv,
    js_value: *mut napi_value__
) -> Result<Vec<T, Global>, NjError>

source§

impl<'a, T0, T1, T2, T3, T4, T5, T6, T7, T8> JSValue<'a> for (T0, T1, T2, T3, T4, T5, T6, T7, T8)where
    T0: JSValue<'a> + Send,
    T1: JSValue<'a> + Send,
    T2: JSValue<'a> + Send,
    T3: JSValue<'a> + Send,
    T4: JSValue<'a> + Send,
    T5: JSValue<'a> + Send,
    T6: JSValue<'a> + Send,
    T7: JSValue<'a> + Send,
    T8: JSValue<'a> + Send,

source§

impl<'a, T0, T1> JSValue<'a> for (T0, T1)where
    T0: JSValue<'a> + Send,
    T1: JSValue<'a> + Send,

source§

fn convert_to_rust(
    env: &'a JsEnv,
    js_value: *mut napi_value__
) -> Result<(T0, T1), NjError>

source§

impl JSValue<'_> for String

source§

fn convert_to_rust(
    env: &JsEnv,
    js_value: *mut napi_value__
) -> Result<String, NjError>

source§

impl<'a, T0, T1, T2> JSValue<'a> for (T0, T1, T2)where
    T0: JSValue<'a> + Send,
    T1: JSValue<'a> + Send,
    T2: JSValue<'a> + Send,

source§

fn convert_to_rust(
    env: &'a JsEnv,
    js_value: *mut napi_value__
) -> Result<(T0, T1, T2), NjError>

source§

impl<'a> JSValue<'a> for &'a [u8]

source§

fn convert_to_rust(
    env: &'a JsEnv,
    js_value: *mut napi_value__
) -> Result<&'a [u8], NjError>

source§

impl<'a> JSValue<'a> for &'a str

source§

fn convert_to_rust(
    env: &'a JsEnv,
    js_value: *mut napi_value__
) -> Result<&'a str, NjError>

source§

impl JSValue<'_> for f64

source§

fn convert_to_rust(
    env: &JsEnv,
    js_value: *mut napi_value__
) -> Result<f64, NjError>

Implementors§