TryFromJs

Trait TryFromJs 

Source
pub trait TryFromJs: Sized {
    // Required method
    fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>;
}
Expand description

This trait adds a fallible and efficient conversions from a JsValue to Rust types.

Required Methods§

Source

fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>

This function tries to convert a JavaScript value into Self.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl TryFromJs for bool

Source§

fn try_from_js(value: &JsValue, _context: &mut Context) -> JsResult<Self>

Source§

impl TryFromJs for f64

Source§

fn try_from_js(value: &JsValue, _context: &mut Context) -> JsResult<Self>

Source§

impl TryFromJs for i8

Source§

fn try_from_js(value: &JsValue, _context: &mut Context) -> JsResult<Self>

Source§

impl TryFromJs for i16

Source§

fn try_from_js(value: &JsValue, _context: &mut Context) -> JsResult<Self>

Source§

impl TryFromJs for i32

Source§

fn try_from_js(value: &JsValue, _context: &mut Context) -> JsResult<Self>

Source§

impl TryFromJs for i64

Source§

fn try_from_js(value: &JsValue, _context: &mut Context) -> JsResult<Self>

Source§

impl TryFromJs for i128

Source§

fn try_from_js(value: &JsValue, _context: &mut Context) -> JsResult<Self>

Source§

impl TryFromJs for u8

Source§

fn try_from_js(value: &JsValue, _context: &mut Context) -> JsResult<Self>

Source§

impl TryFromJs for u16

Source§

fn try_from_js(value: &JsValue, _context: &mut Context) -> JsResult<Self>

Source§

impl TryFromJs for u32

Source§

fn try_from_js(value: &JsValue, _context: &mut Context) -> JsResult<Self>

Source§

impl TryFromJs for u64

Source§

fn try_from_js(value: &JsValue, _context: &mut Context) -> JsResult<Self>

Source§

impl TryFromJs for u128

Source§

fn try_from_js(value: &JsValue, _context: &mut Context) -> JsResult<Self>

Source§

impl TryFromJs for ()

Source§

fn try_from_js(_value: &JsValue, _context: &mut Context) -> JsResult<Self>

Source§

impl TryFromJs for usize

Source§

fn try_from_js(value: &JsValue, _context: &mut Context) -> JsResult<Self>

Source§

impl TryFromJs for String

Source§

fn try_from_js(value: &JsValue, _context: &mut Context) -> JsResult<Self>

Source§

impl TryFromJs for BigInt

Source§

fn try_from_js(value: &JsValue, _context: &mut Context) -> JsResult<Self>

Source§

impl<A: TryFromJs> TryFromJs for (A,)

Source§

fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>

Source§

impl<A: TryFromJs, B: TryFromJs> TryFromJs for (A, B)

Source§

fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>

Source§

impl<A: TryFromJs, B: TryFromJs, C: TryFromJs> TryFromJs for (A, B, C)

Source§

fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>

Source§

impl<A: TryFromJs, B: TryFromJs, C: TryFromJs, D: TryFromJs> TryFromJs for (A, B, C, D)

Source§

fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>

Source§

impl<A: TryFromJs, B: TryFromJs, C: TryFromJs, D: TryFromJs, E: TryFromJs> TryFromJs for (A, B, C, D, E)

Source§

fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>

Source§

impl<A: TryFromJs, B: TryFromJs, C: TryFromJs, D: TryFromJs, E: TryFromJs, F: TryFromJs> TryFromJs for (A, B, C, D, E, F)

Source§

fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>

Source§

impl<A: TryFromJs, B: TryFromJs, C: TryFromJs, D: TryFromJs, E: TryFromJs, F: TryFromJs, G: TryFromJs> TryFromJs for (A, B, C, D, E, F, G)

Source§

fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>

Source§

impl<A: TryFromJs, B: TryFromJs, C: TryFromJs, D: TryFromJs, E: TryFromJs, F: TryFromJs, G: TryFromJs, H: TryFromJs> TryFromJs for (A, B, C, D, E, F, G, H)

Source§

fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>

Source§

impl<A: TryFromJs, B: TryFromJs, C: TryFromJs, D: TryFromJs, E: TryFromJs, F: TryFromJs, G: TryFromJs, H: TryFromJs, I: TryFromJs> TryFromJs for (A, B, C, D, E, F, G, H, I)

Source§

fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>

Source§

impl<A: TryFromJs, B: TryFromJs, C: TryFromJs, D: TryFromJs, E: TryFromJs, F: TryFromJs, G: TryFromJs, H: TryFromJs, I: TryFromJs, J: TryFromJs> TryFromJs for (A, B, C, D, E, F, G, H, I, J)

Source§

fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>

Source§

impl<K, V> TryFromJs for BTreeMap<K, V>
where K: TryFromJs + Ord, V: TryFromJs,

Source§

fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>

Source§

impl<K, V, S> TryFromJs for HashMap<K, V, S>
where K: TryFromJs + Ord + Hash, V: TryFromJs, S: BuildHasher + Default,

Source§

fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>

Source§

impl<L, R> TryFromJs for Either<L, R>
where L: TryFromJs, R: TryFromJs,

Source§

fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>

Source§

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

Source§

fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>

Source§

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

Source§

fn try_from_js(value: &JsValue, context: &mut Context) -> JsResult<Self>

Implementors§

Source§

impl TryFromJs for JsBigInt

Source§

impl TryFromJs for JsArray

Source§

impl TryFromJs for JsArrayBuffer

Source§

impl TryFromJs for JsBigInt64Array

Source§

impl TryFromJs for JsBigUint64Array

Source§

impl TryFromJs for JsDataView

Source§

impl TryFromJs for JsDate

Source§

impl TryFromJs for JsFloat16Array

Source§

impl TryFromJs for JsFloat32Array

Source§

impl TryFromJs for JsFloat64Array

Source§

impl TryFromJs for JsFunction

Source§

impl TryFromJs for JsGenerator

Source§

impl TryFromJs for JsInt8Array

Source§

impl TryFromJs for JsInt16Array

Source§

impl TryFromJs for JsInt32Array

Source§

impl TryFromJs for JsMap

Source§

impl TryFromJs for JsMapIterator

Source§

impl TryFromJs for JsPromise

Source§

impl TryFromJs for JsProxy

Source§

impl TryFromJs for JsRegExp

Source§

impl TryFromJs for JsSet

Source§

impl TryFromJs for JsSetIterator

Source§

impl TryFromJs for JsSharedArrayBuffer

Source§

impl TryFromJs for JsTypedArray

Source§

impl TryFromJs for JsUint8Array

Source§

impl TryFromJs for JsUint8ClampedArray

Source§

impl TryFromJs for JsUint16Array

Source§

impl TryFromJs for JsUint32Array

Source§

impl TryFromJs for JsObject

Source§

impl TryFromJs for JsString

Source§

impl TryFromJs for Convert<bool>

Source§

impl TryFromJs for Convert<f64>

Source§

impl TryFromJs for Convert<i8>

Source§

impl TryFromJs for Convert<i16>

Source§

impl TryFromJs for Convert<i32>

Source§

impl TryFromJs for Convert<u8>

Source§

impl TryFromJs for Convert<u16>

Source§

impl TryFromJs for Convert<u32>

Source§

impl TryFromJs for Convert<JsString>

Source§

impl TryFromJs for Convert<String>

Source§

impl TryFromJs for JsValue

Source§

impl<A: TryIntoJsArguments, R: TryFromJs> TryFromJs for TypedJsFunction<A, R>

Source§

impl<T: TryFromJs> TryFromJs for Nullable<T>