pub trait FromJs<'js>: Sized {
    fn from_js(ctx: Ctx<'js>, value: Value<'js>) -> Result<Self>;
}
Expand description

For converting javascript values to rust values

This trait automatically converts any value which can be represented as an object, like Array to one if it is required.

Required Methods

Implementations on Foreign Types

Convert from JS as any

Convert from JS as optional

Convert from JS to either

Convert from JS array to Rust vector

Convert from JS array to Rust vector deque

Convert from JS array to Rust linked list

Convert from JS array to Rust hash set

Convert from JS array to Rust btree set

Convert from JS array to Rust index set

Convert from JS object to Rust hash map

Convert from JS object to Rust btree map

Convert from JS object to Rust index map

Implementors

Coerce a value to a bool in the same way javascript would coerce values

Coerce a value to a f64 in the same way javascript would coerce values

Coerce a value to a i32 in the same way javascript would coerce values

Coerce a value to a i64 in the same way javascript would coerce values

Coerce a value to a u64 in the same way javascript would coerce values

Coerce a value to a string in the same way javascript would coerce values.

Coerce a value to a string in the same way javascript would coerce values.

Convert from JS as result