Skip to main content

FromNapiValue

Trait FromNapiValue 

Source
pub trait FromNapiValue: Sized {
    // Required method
    unsafe fn from_napi_value(
        env: napi_env,
        napi_val: napi_value,
    ) -> Result<Self>;

    // Provided method
    fn from_unknown(value: Unknown<'_>) -> Result<Self> { ... }
}

Required Methods§

Source

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

This function called to convert napi values to native rust values

§Safety

The caller must ensure that:

  • The env is a valid napi env pointer
  • The napi_val is a valid js value pointer
  • The napi_val is a valid type that can be converted into Self using ValidateNapiValue::validate

Provided Methods§

Source

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FromNapiValue for &[f32]

Source§

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

Source§

impl FromNapiValue for &[f64]

Source§

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

Source§

impl FromNapiValue for &[i8]

Source§

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

Source§

impl FromNapiValue for &[i16]

Source§

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

Source§

impl FromNapiValue for &[i32]

Source§

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

Source§

impl FromNapiValue for &[i64]

Source§

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

Source§

impl FromNapiValue for &[u8]

Source§

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

Source§

impl FromNapiValue for &[u16]

Source§

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

Source§

impl FromNapiValue for &[u32]

Source§

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

Source§

impl FromNapiValue for &[u64]

Source§

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

Source§

impl FromNapiValue for &mut [f32]

Source§

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

Source§

impl FromNapiValue for &mut [f64]

Source§

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

Source§

impl FromNapiValue for &mut [i8]

Source§

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

Source§

impl FromNapiValue for &mut [i16]

Source§

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

Source§

impl FromNapiValue for &mut [i32]

Source§

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

Source§

impl FromNapiValue for &mut [i64]

Source§

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

Source§

impl FromNapiValue for &mut [u8]

Source§

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

Source§

impl FromNapiValue for &mut [u16]

Source§

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

Source§

impl FromNapiValue for &mut [u32]

Source§

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

Source§

impl FromNapiValue for &mut [u64]

Source§

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

Source§

impl FromNapiValue for Map<String, Value>

Source§

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

Source§

impl FromNapiValue for NaiveDateTime

Source§

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

Source§

impl FromNapiValue for Number

Source§

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

Source§

impl FromNapiValue for OsString

Source§

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

Source§

impl FromNapiValue for PathBuf

Source§

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

Source§

impl FromNapiValue for String

Source§

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

Source§

impl FromNapiValue for Value

Source§

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

Source§

impl FromNapiValue for bool

Source§

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

Source§

impl FromNapiValue for f64

Source§

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

Source§

impl FromNapiValue for i8

Source§

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

Source§

impl FromNapiValue for i16

Source§

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

Source§

impl FromNapiValue for i32

Source§

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

Source§

impl FromNapiValue for i64

Source§

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

Source§

impl FromNapiValue for u8

Source§

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

Source§

impl FromNapiValue for u16

Source§

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

Source§

impl FromNapiValue for u32

Source§

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

Source§

impl<K, V, S> FromNapiValue for HashMap<K, V, S>

Source§

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

Source§

impl<K, V, S> FromNapiValue for IndexMap<K, V, S>

Available on crate feature object_indexmap only.
Source§

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

Source§

impl<K, V> FromNapiValue for BTreeMap<K, V>
where K: From<String> + Ord, V: FromNapiValue,

Source§

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

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> FromNapiValue for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)

Source§

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

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> FromNapiValue for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)

Source§

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

Source§

impl<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> FromNapiValue for (T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)

Source§

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

Source§

impl<T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> FromNapiValue for (T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)

Source§

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

Source§

impl<T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> FromNapiValue for (T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)

Source§

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

Source§

impl<T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> FromNapiValue for (T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)

Source§

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

Source§

impl<T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> FromNapiValue for (T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)

Source§

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

Source§

impl<T7, T8, T9, T10, T11, T12, T13, T14, T15> FromNapiValue for (T7, T8, T9, T10, T11, T12, T13, T14, T15)

Source§

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

Source§

impl<T8, T9, T10, T11, T12, T13, T14, T15> FromNapiValue for (T8, T9, T10, T11, T12, T13, T14, T15)

Source§

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

Source§

impl<T9, T10, T11, T12, T13, T14, T15> FromNapiValue for (T9, T10, T11, T12, T13, T14, T15)

Source§

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

Source§

impl<T10, T11, T12, T13, T14, T15> FromNapiValue for (T10, T11, T12, T13, T14, T15)

Source§

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

Source§

impl<T11, T12, T13, T14, T15> FromNapiValue for (T11, T12, T13, T14, T15)

Source§

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

Source§

impl<T12, T13, T14, T15> FromNapiValue for (T12, T13, T14, T15)

Source§

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

Source§

impl<T13, T14, T15> FromNapiValue for (T13, T14, T15)
where T13: FromNapiValue, T14: FromNapiValue, T15: FromNapiValue,

Source§

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

Source§

impl<T14, T15> FromNapiValue for (T14, T15)
where T14: FromNapiValue, T15: FromNapiValue,

Source§

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

Source§

impl<T15> FromNapiValue for (T15,)
where T15: FromNapiValue,

Source§

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

Source§

impl<T: FromNapiMutRef + 'static> FromNapiValue for &mut T

Source§

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

Source§

impl<T: FromNapiRef + 'static> FromNapiValue for &T

Source§

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

Source§

impl<T> FromNapiValue for Arc<T>
where T: FromNapiValue,

Source§

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

Source§

impl<T> FromNapiValue for Mutex<T>
where T: FromNapiValue,

Source§

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

Source§

impl<T> FromNapiValue for Option<T>
where T: FromNapiValue,

Source§

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

Source§

impl<T> FromNapiValue for Rc<T>
where T: FromNapiValue,

Source§

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

Source§

impl<T> FromNapiValue for Vec<T>
where T: FromNapiValue,

Source§

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

Source§

impl<Tz: TimeZone> FromNapiValue for DateTime<Tz>
where DateTime<Tz>: From<DateTime<Local>>,

Source§

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

Source§

impl<V, S> FromNapiValue for HashSet<V, S>

Source§

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

Source§

impl<V, S> FromNapiValue for IndexSet<V, S>

Available on crate feature object_indexmap only.
Source§

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

Source§

impl<V> FromNapiValue for BTreeSet<V>
where V: FromNapiValue + Ord,

Source§

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

Implementors§

Source§

impl FromNapiValue for AbortSignal

Source§

impl FromNapiValue for Array<'_>

Source§

impl FromNapiValue for ArrayBuffer<'_>

Source§

impl FromNapiValue for BigInt

Source§

impl FromNapiValue for BigInt64Array

Source§

impl FromNapiValue for BigInt64ArraySlice<'_>

Source§

impl FromNapiValue for BigUint64Array

Source§

impl FromNapiValue for BigUint64ArraySlice<'_>

Source§

impl FromNapiValue for Buffer

Source§

impl FromNapiValue for BufferSlice<'_>

Source§

impl FromNapiValue for Float32Array

Source§

impl FromNapiValue for Float32ArraySlice<'_>

Source§

impl FromNapiValue for Float64Array

Source§

impl FromNapiValue for Float64ArraySlice<'_>

Source§

impl FromNapiValue for Int8Array

Source§

impl FromNapiValue for Int8ArraySlice<'_>

Source§

impl FromNapiValue for Int16Array

Source§

impl FromNapiValue for Int16ArraySlice<'_>

Source§

impl FromNapiValue for Int32Array

Source§

impl FromNapiValue for Int32ArraySlice<'_>

Source§

impl FromNapiValue for JSON<'_>

Source§

impl FromNapiValue for JsArrayBuffer

Source§

impl FromNapiValue for JsBigInt

Source§

impl FromNapiValue for JsBuffer

Source§

impl FromNapiValue for JsDate<'_>

Source§

impl FromNapiValue for JsGlobal<'_>

Source§

impl FromNapiValue for JsNumber<'_>

Source§

impl FromNapiValue for JsObject

Source§

impl FromNapiValue for JsString<'_>

Source§

impl FromNapiValue for JsSymbol<'_>

Source§

impl FromNapiValue for JsTimeout<'_>

Source§

impl FromNapiValue for JsTypedArray

Source§

impl FromNapiValue for JsUndefined

Source§

impl FromNapiValue for Latin1String

Source§

impl FromNapiValue for Null

Source§

impl FromNapiValue for Object<'_>

Source§

impl FromNapiValue for Symbol

Source§

impl FromNapiValue for TypedArray<'_>

Source§

impl FromNapiValue for Uint8Array

Source§

impl FromNapiValue for Uint8ArraySlice<'_>

Source§

impl FromNapiValue for Uint8ClampedArray

Source§

impl FromNapiValue for Uint8ClampedSlice<'_>

Source§

impl FromNapiValue for Uint16Array

Source§

impl FromNapiValue for Uint16ArraySlice<'_>

Source§

impl FromNapiValue for Uint32Array

Source§

impl FromNapiValue for Uint32ArraySlice<'_>

Source§

impl FromNapiValue for Undefined

Source§

impl FromNapiValue for Unknown<'_>

Source§

impl FromNapiValue for UnknownReturnValue

Source§

impl FromNapiValue for Utf16String

Source§

impl FromNapiValue for WriteableStream<'_>

Source§

impl<'env, T: 'env + MaybeTypeTag> FromNapiValue for ClassInstance<'env, T>

Source§

impl<'env, T: FromNapiValue + JsValue<'env>> FromNapiValue for Ref<T>

Source§

impl<'env> FromNapiValue for JsExternal<'env>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z> FromNapiValue for Either26<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y> FromNapiValue for Either25<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X> FromNapiValue for Either24<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W> FromNapiValue for Either23<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V> FromNapiValue for Either22<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U> FromNapiValue for Either21<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T> FromNapiValue for Either20<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S> FromNapiValue for Either19<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R> FromNapiValue for Either18<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q> FromNapiValue for Either17<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> FromNapiValue for Either16<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> FromNapiValue for Either15<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N> FromNapiValue for Either14<A, B, C, D, E, F, G, H, I, J, K, L, M, N>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M> FromNapiValue for Either13<A, B, C, D, E, F, G, H, I, J, K, L, M>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K, L> FromNapiValue for Either12<A, B, C, D, E, F, G, H, I, J, K, L>

Source§

impl<A, B, C, D, E, F, G, H, I, J, K> FromNapiValue for Either11<A, B, C, D, E, F, G, H, I, J, K>

Source§

impl<A, B, C, D, E, F, G, H, I, J> FromNapiValue for Either10<A, B, C, D, E, F, G, H, I, J>

Source§

impl<A, B, C, D, E, F, G, H, I> FromNapiValue for Either9<A, B, C, D, E, F, G, H, I>

Source§

impl<A, B, C, D, E, F, G, H> FromNapiValue for Either8<A, B, C, D, E, F, G, H>

Source§

impl<A, B, C, D, E, F, G> FromNapiValue for Either7<A, B, C, D, E, F, G>

Source§

impl<A, B, C, D, E, F> FromNapiValue for Either6<A, B, C, D, E, F>

Source§

impl<A, B, C, D, E> FromNapiValue for Either5<A, B, C, D, E>

Source§

impl<A, B, C, D> FromNapiValue for Either4<A, B, C, D>

Source§

impl<A, B, C> FromNapiValue for Either3<A, B, C>

Source§

impl<A, B> FromNapiValue for Either<A, B>

Source§

impl<Args: JsValuesTupleIntoVec, Return> FromNapiValue for Function<'_, Args, Return>

Source§

impl<Args: JsValuesTupleIntoVec, Return> FromNapiValue for FunctionRef<Args, Return>

Source§

impl<T: 'static + JsValuesTupleIntoVec, Return: FromNapiValue, ErrorStatus: AsRef<str> + From<Status>, const CalleeHandled: bool, const Weak: bool, const MaxQueueSize: usize> FromNapiValue for ThreadsafeFunction<T, Return, T, ErrorStatus, CalleeHandled, Weak, MaxQueueSize>

Source§

impl<T: 'static + MaybeTypeTag> FromNapiValue for Reference<T>

Source§

impl<T: 'static> FromNapiValue for ExternalRef<T>

Source§

impl<T: FromNapiValue> FromNapiValue for IteratorValue<'_, T>

Source§

impl<T: FromNapiValue> FromNapiValue for Promise<T>

Source§

impl<T: FromNapiValue> FromNapiValue for This<'_, T>

Source§

impl<T> FromNapiValue for PromiseRaw<'_, T>

Source§

impl<T> FromNapiValue for ReadableStream<'_, T>

Source§

impl<const LEAK_CHECK: bool> FromNapiValue for ObjectRef<LEAK_CHECK>

Source§

impl<const LEAK_CHECK: bool> FromNapiValue for SymbolRef<LEAK_CHECK>

Source§

impl<const LEAK_CHECK: bool> FromNapiValue for UnknownRef<LEAK_CHECK>