Trait neon::types::extract::TryFromJs

source ·
pub trait TryFromJs<'cx>
where Self: Sealed + Sized,
{ type Error; // Required methods fn try_from_js<C>( cx: &mut C, v: Handle<'cx, JsValue> ) -> NeonResult<Result<Self, Self::Error>> where C: Context<'cx>; fn from_js<C>(cx: &mut C, v: Handle<'cx, JsValue>) -> NeonResult<Self> where C: Context<'cx>; }
Expand description

Extract Rust data from a JavaScript value

Required Associated Types§

Required Methods§

source

fn try_from_js<C>( cx: &mut C, v: Handle<'cx, JsValue> ) -> NeonResult<Result<Self, Self::Error>>
where C: Context<'cx>,

source

fn from_js<C>(cx: &mut C, v: Handle<'cx, JsValue>) -> NeonResult<Self>
where C: Context<'cx>,

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'cx> TryFromJs<'cx> for bool

§

type Error = TypeExpected<JsBoolean>

source§

fn try_from_js<C>( cx: &mut C, v: Handle<'cx, JsValue> ) -> NeonResult<Result<Self, Self::Error>>
where C: Context<'cx>,

source§

fn from_js<C>(cx: &mut C, v: Handle<'cx, JsValue>) -> NeonResult<Self>
where C: Context<'cx>,

source§

impl<'cx> TryFromJs<'cx> for f64

§

type Error = TypeExpected<JsNumber>

source§

fn try_from_js<C>( cx: &mut C, v: Handle<'cx, JsValue> ) -> NeonResult<Result<Self, Self::Error>>
where C: Context<'cx>,

source§

fn from_js<C>(cx: &mut C, v: Handle<'cx, JsValue>) -> NeonResult<Self>
where C: Context<'cx>,

source§

impl<'cx> TryFromJs<'cx> for ()

§

type Error = Infallible

source§

fn try_from_js<C>( _cx: &mut C, _v: Handle<'cx, JsValue> ) -> NeonResult<Result<Self, Self::Error>>
where C: Context<'cx>,

source§

fn from_js<C>(_cx: &mut C, _v: Handle<'cx, JsValue>) -> NeonResult<Self>
where C: Context<'cx>,

source§

impl<'cx> TryFromJs<'cx> for String

§

type Error = TypeExpected<JsString>

source§

fn try_from_js<C>( cx: &mut C, v: Handle<'cx, JsValue> ) -> NeonResult<Result<Self, Self::Error>>
where C: Context<'cx>,

source§

fn from_js<C>(cx: &mut C, v: Handle<'cx, JsValue>) -> NeonResult<Self>
where C: Context<'cx>,

source§

impl<'cx, T> TryFromJs<'cx> for Option<T>
where T: TryFromJs<'cx>,

§

type Error = <T as TryFromJs<'cx>>::Error

source§

fn try_from_js<C>( cx: &mut C, v: Handle<'cx, JsValue> ) -> NeonResult<Result<Self, Self::Error>>
where C: Context<'cx>,

source§

fn from_js<C>(cx: &mut C, v: Handle<'cx, JsValue>) -> NeonResult<Self>
where C: Context<'cx>,

source§

impl<'cx, T> TryFromJs<'cx> for Vec<T>
where JsTypedArray<T>: Value, T: Binary,

§

type Error = TypeExpected<JsTypedArray<T>>

source§

fn try_from_js<C>( cx: &mut C, v: Handle<'cx, JsValue> ) -> NeonResult<Result<Self, Self::Error>>
where C: Context<'cx>,

source§

fn from_js<C>(cx: &mut C, v: Handle<'cx, JsValue>) -> NeonResult<Self>
where C: Context<'cx>,

Implementors§

source§

impl<'cx> TryFromJs<'cx> for ArrayBuffer

source§

impl<'cx> TryFromJs<'cx> for Buffer

source§

impl<'cx> TryFromJs<'cx> for Date

Available on crate feature napi-5 only.
source§

impl<'cx, T> TryFromJs<'cx> for Json<T>
where for<'de> T: Deserialize<'de>,

§

type Error = Error

source§

impl<'cx, V> TryFromJs<'cx> for Handle<'cx, V>
where V: Value,