wasm_bindgen

Struct JsValue

Source
pub struct JsValue { /* private fields */ }
Expand description

Representation of an object owned by JS.

A JsValue doesn’t actually live in Rust right now but actually in a table owned by the wasm-bindgen generated JS glue code. Eventually the ownership will transfer into Wasm directly and this will likely become more efficient, but for now it may be slightly slow.

Implementations§

Source§

impl JsValue

Source

pub const NULL: JsValue = _

The null JS value constant.

Source

pub const UNDEFINED: JsValue = _

The undefined JS value constant.

Source

pub const TRUE: JsValue = _

The true JS value constant.

Source

pub const FALSE: JsValue = _

The false JS value constant.

Source

pub fn from_str(s: &str) -> JsValue

Creates a new JS value which is a string.

The utf-8 string provided is copied to the JS heap and the string will be owned by the JS garbage collector.

Source

pub fn from_f64(n: f64) -> JsValue

Creates a new JS value which is a number.

This function creates a JS value representing a number (a heap allocated number) and returns a handle to the JS version of it.

Source

pub fn bigint_from_str(s: &str) -> JsValue

Creates a new JS value which is a bigint from a string representing a number.

This function creates a JS value representing a bigint (a heap allocated large integer) and returns a handle to the JS version of it.

Source

pub const fn from_bool(b: bool) -> JsValue

Creates a new JS value which is a boolean.

This function creates a JS object representing a boolean (a heap allocated boolean) and returns a handle to the JS version of it.

Source

pub const fn undefined() -> JsValue

Creates a new JS value representing undefined.

Source

pub const fn null() -> JsValue

Creates a new JS value representing null.

Source

pub fn symbol(description: Option<&str>) -> JsValue

Creates a new JS symbol with the optional description specified.

This function will invoke the Symbol constructor in JS and return the JS object corresponding to the symbol created.

Source

pub fn from_serde<T>(t: &T) -> Result<JsValue>
where T: Serialize + ?Sized,

👎Deprecated: causes dependency cycles, use serde-wasm-bindgen or gloo_utils::format::JsValueSerdeExt instead

Creates a new JsValue from the JSON serialization of the object t provided.

This function is deprecated, due to creating a dependency cycle in some circumstances. Use serde-wasm-bindgen or gloo_utils::format::JsValueSerdeExt instead.

This function will serialize the provided value t to a JSON string, send the JSON string to JS, parse it into a JS object, and then return a handle to the JS object. This is unlikely to be super speedy so it’s not recommended for large payloads, but it’s a nice to have in some situations!

Usage of this API requires activating the serde-serialize feature of the wasm-bindgen crate.

§Errors

Returns any error encountered when serializing T into JSON.

Source

pub fn into_serde<T>(&self) -> Result<T>
where T: for<'a> Deserialize<'a>,

👎Deprecated: causes dependency cycles, use serde-wasm-bindgen or gloo_utils::format::JsValueSerdeExt instead

Invokes JSON.stringify on this value and then parses the resulting JSON into an arbitrary Rust value.

This function is deprecated, due to creating a dependency cycle in some circumstances. Use serde-wasm-bindgen or gloo_utils::format::JsValueSerdeExt instead.

This function will first call JSON.stringify on the JsValue itself. The resulting string is then passed into Rust which then parses it as JSON into the resulting value.

Usage of this API requires activating the serde-serialize feature of the wasm-bindgen crate.

§Errors

Returns any error encountered when parsing the JSON into a T.

Source

pub fn as_f64(&self) -> Option<f64>

Returns the f64 value of this JS value if it’s an instance of a number.

If this JS value is not an instance of a number then this returns None.

Source

pub fn is_string(&self) -> bool

Tests whether this JS value is a JS string.

Source

pub fn as_string(&self) -> Option<String>

If this JS value is a string value, this function copies the JS string value into Wasm linear memory, encoded as UTF-8, and returns it as a Rust String.

To avoid the copying and re-encoding, consider the JsString::try_from() function from js-sys instead.

If this JS value is not an instance of a string or if it’s not valid utf-8 then this returns None.

§UTF-16 vs UTF-8

JavaScript strings in general are encoded as UTF-16, but Rust strings are encoded as UTF-8. This can cause the Rust string to look a bit different than the JS string sometimes. For more details see the documentation about the str type which contains a few caveats about the encodings.

Source

pub fn as_bool(&self) -> Option<bool>

Returns the bool value of this JS value if it’s an instance of a boolean.

If this JS value is not an instance of a boolean then this returns None.

Source

pub fn is_null(&self) -> bool

Tests whether this JS value is null

Source

pub fn is_undefined(&self) -> bool

Tests whether this JS value is undefined

Source

pub fn is_symbol(&self) -> bool

Tests whether the type of this JS value is symbol

Source

pub fn is_object(&self) -> bool

Tests whether typeof self == "object" && self !== null.

Source

pub fn is_array(&self) -> bool

Tests whether this JS value is an instance of Array.

Source

pub fn is_function(&self) -> bool

Tests whether the type of this JS value is function.

Source

pub fn is_bigint(&self) -> bool

Tests whether the type of this JS value is bigint.

Source

pub fn js_typeof(&self) -> JsValue

Applies the unary typeof JS operator on a JsValue.

MDN documentation

Source

pub fn js_in(&self, obj: &JsValue) -> bool

Applies the binary in JS operator on the two JsValues.

MDN documentation

Source

pub fn is_truthy(&self) -> bool

Tests whether the value is “truthy”.

Source

pub fn is_falsy(&self) -> bool

Tests whether the value is “falsy”.

Source

pub fn loose_eq(&self, other: &Self) -> bool

Compare two JsValues for equality, using the == operator in JS.

MDN documentation

Source

pub fn bit_not(&self) -> JsValue

Applies the unary ~ JS operator on a JsValue.

MDN documentation

Source

pub fn unsigned_shr(&self, rhs: &Self) -> u32

Applies the binary >>> JS operator on the two JsValues.

MDN documentation

Source

pub fn checked_div(&self, rhs: &Self) -> Self

Applies the binary / JS operator on two JsValues, catching and returning any RangeError thrown.

MDN documentation

Source

pub fn pow(&self, rhs: &Self) -> Self

Applies the binary ** JS operator on the two JsValues.

MDN documentation

Source

pub fn lt(&self, other: &Self) -> bool

Applies the binary < JS operator on the two JsValues.

MDN documentation

Source

pub fn le(&self, other: &Self) -> bool

Applies the binary <= JS operator on the two JsValues.

MDN documentation

Source

pub fn ge(&self, other: &Self) -> bool

Applies the binary >= JS operator on the two JsValues.

MDN documentation

Source

pub fn gt(&self, other: &Self) -> bool

Applies the binary > JS operator on the two JsValues.

MDN documentation

Source

pub fn unchecked_into_f64(&self) -> f64

Applies the unary + JS operator on a JsValue. Can throw.

MDN documentation

Trait Implementations§

Source§

impl Add<&JsValue> for JsValue

Source§

type Output = <&'static JsValue as Add>::Output

The resulting type after applying the + operator.
Source§

fn add( self, other: &JsValue, ) -> <&'static JsValue as Add<&'static JsValue>>::Output

Performs the + operation. Read more
Source§

impl<'a> Add<JsValue> for &'a JsValue

Source§

type Output = <&'static JsValue as Add>::Output

The resulting type after applying the + operator.
Source§

fn add( self, other: JsValue, ) -> <&'static JsValue as Add<&'static JsValue>>::Output

Performs the + operation. Read more
Source§

impl Add for &JsValue

Source§

fn add(self, rhs: Self) -> Self::Output

Applies the binary + JS operator on two JsValues.

MDN documentation

Source§

type Output = JsValue

The resulting type after applying the + operator.
Source§

impl Add for JsValue

Source§

type Output = <&'static JsValue as Add>::Output

The resulting type after applying the + operator.
Source§

fn add( self, other: JsValue, ) -> <&'static JsValue as Add<&'static JsValue>>::Output

Performs the + operation. Read more
Source§

impl<T: ?Sized> AsRef<JsValue> for Closure<T>

Source§

fn as_ref(&self) -> &JsValue

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<JsValue> for JsValue

Source§

fn as_ref(&self) -> &JsValue

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl BitAnd<&JsValue> for JsValue

Source§

type Output = <&'static JsValue as BitAnd>::Output

The resulting type after applying the & operator.
Source§

fn bitand( self, other: &JsValue, ) -> <&'static JsValue as BitAnd<&'static JsValue>>::Output

Performs the & operation. Read more
Source§

impl<'a> BitAnd<JsValue> for &'a JsValue

Source§

type Output = <&'static JsValue as BitAnd>::Output

The resulting type after applying the & operator.
Source§

fn bitand( self, other: JsValue, ) -> <&'static JsValue as BitAnd<&'static JsValue>>::Output

Performs the & operation. Read more
Source§

impl BitAnd for &JsValue

Source§

fn bitand(self, rhs: Self) -> Self::Output

Applies the binary & JS operator on two JsValues.

MDN documentation

Source§

type Output = JsValue

The resulting type after applying the & operator.
Source§

impl BitAnd for JsValue

Source§

type Output = <&'static JsValue as BitAnd>::Output

The resulting type after applying the & operator.
Source§

fn bitand( self, other: JsValue, ) -> <&'static JsValue as BitAnd<&'static JsValue>>::Output

Performs the & operation. Read more
Source§

impl BitOr<&JsValue> for JsValue

Source§

type Output = <&'static JsValue as BitOr>::Output

The resulting type after applying the | operator.
Source§

fn bitor( self, other: &JsValue, ) -> <&'static JsValue as BitOr<&'static JsValue>>::Output

Performs the | operation. Read more
Source§

impl<'a> BitOr<JsValue> for &'a JsValue

Source§

type Output = <&'static JsValue as BitOr>::Output

The resulting type after applying the | operator.
Source§

fn bitor( self, other: JsValue, ) -> <&'static JsValue as BitOr<&'static JsValue>>::Output

Performs the | operation. Read more
Source§

impl BitOr for &JsValue

Source§

fn bitor(self, rhs: Self) -> Self::Output

Applies the binary | JS operator on two JsValues.

MDN documentation

Source§

type Output = JsValue

The resulting type after applying the | operator.
Source§

impl BitOr for JsValue

Source§

type Output = <&'static JsValue as BitOr>::Output

The resulting type after applying the | operator.
Source§

fn bitor( self, other: JsValue, ) -> <&'static JsValue as BitOr<&'static JsValue>>::Output

Performs the | operation. Read more
Source§

impl BitXor<&JsValue> for JsValue

Source§

type Output = <&'static JsValue as BitXor>::Output

The resulting type after applying the ^ operator.
Source§

fn bitxor( self, other: &JsValue, ) -> <&'static JsValue as BitXor<&'static JsValue>>::Output

Performs the ^ operation. Read more
Source§

impl<'a> BitXor<JsValue> for &'a JsValue

Source§

type Output = <&'static JsValue as BitXor>::Output

The resulting type after applying the ^ operator.
Source§

fn bitxor( self, other: JsValue, ) -> <&'static JsValue as BitXor<&'static JsValue>>::Output

Performs the ^ operation. Read more
Source§

impl BitXor for &JsValue

Source§

fn bitxor(self, rhs: Self) -> Self::Output

Applies the binary ^ JS operator on two JsValues.

MDN documentation

Source§

type Output = JsValue

The resulting type after applying the ^ operator.
Source§

impl BitXor for JsValue

Source§

type Output = <&'static JsValue as BitXor>::Output

The resulting type after applying the ^ operator.
Source§

fn bitxor( self, other: JsValue, ) -> <&'static JsValue as BitXor<&'static JsValue>>::Output

Performs the ^ operation. Read more
Source§

impl Clone for JsValue

Source§

fn clone(&self) -> JsValue

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for JsValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for JsValue

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Div<&JsValue> for JsValue

Source§

type Output = <&'static JsValue as Div>::Output

The resulting type after applying the / operator.
Source§

fn div( self, other: &JsValue, ) -> <&'static JsValue as Div<&'static JsValue>>::Output

Performs the / operation. Read more
Source§

impl<'a> Div<JsValue> for &'a JsValue

Source§

type Output = <&'static JsValue as Div>::Output

The resulting type after applying the / operator.
Source§

fn div( self, other: JsValue, ) -> <&'static JsValue as Div<&'static JsValue>>::Output

Performs the / operation. Read more
Source§

impl Div for &JsValue

Source§

fn div(self, rhs: Self) -> Self::Output

Applies the binary / JS operator on two JsValues.

MDN documentation

Source§

type Output = JsValue

The resulting type after applying the / operator.
Source§

impl Div for JsValue

Source§

type Output = <&'static JsValue as Div>::Output

The resulting type after applying the / operator.
Source§

fn div( self, other: JsValue, ) -> <&'static JsValue as Div<&'static JsValue>>::Output

Performs the / operation. Read more
Source§

impl Drop for JsValue

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a> From<&'a String> for JsValue

Source§

fn from(s: &'a String) -> JsValue

Converts to this type from the input type.
Source§

impl<'a, T> From<&'a T> for JsValue
where T: JsCast,

Source§

fn from(s: &'a T) -> JsValue

Converts to this type from the input type.
Source§

impl<'a> From<&'a str> for JsValue

Source§

fn from(s: &'a str) -> JsValue

Converts to this type from the input type.
Source§

impl<T> From<*const T> for JsValue

Source§

fn from(s: *const T) -> JsValue

Converts to this type from the input type.
Source§

impl<T> From<*mut T> for JsValue

Source§

fn from(s: *mut T) -> JsValue

Converts to this type from the input type.
Source§

impl<T: VectorIntoJsValue> From<Box<[T]>> for JsValue

Source§

fn from(vector: Box<[T]>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<[f32]>> for JsValue

Source§

fn from(vector: Box<[f32]>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<[f64]>> for JsValue

Source§

fn from(vector: Box<[f64]>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<[i16]>> for JsValue

Source§

fn from(vector: Box<[i16]>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<[i32]>> for JsValue

Source§

fn from(vector: Box<[i32]>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<[i64]>> for JsValue

Source§

fn from(vector: Box<[i64]>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<[i8]>> for JsValue

Source§

fn from(vector: Box<[i8]>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<[u16]>> for JsValue

Source§

fn from(vector: Box<[u16]>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<[u32]>> for JsValue

Source§

fn from(vector: Box<[u32]>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<[u64]>> for JsValue

Source§

fn from(vector: Box<[u64]>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<[u8]>> for JsValue

Source§

fn from(vector: Box<[u8]>) -> Self

Converts to this type from the input type.
Source§

impl From<Clamped<Box<[f32]>>> for JsValue

Source§

fn from(vector: Clamped<Box<[f32]>>) -> Self

Converts to this type from the input type.
Source§

impl From<Clamped<Box<[f64]>>> for JsValue

Source§

fn from(vector: Clamped<Box<[f64]>>) -> Self

Converts to this type from the input type.
Source§

impl From<Clamped<Box<[i16]>>> for JsValue

Source§

fn from(vector: Clamped<Box<[i16]>>) -> Self

Converts to this type from the input type.
Source§

impl From<Clamped<Box<[i32]>>> for JsValue

Source§

fn from(vector: Clamped<Box<[i32]>>) -> Self

Converts to this type from the input type.
Source§

impl From<Clamped<Box<[i64]>>> for JsValue

Source§

fn from(vector: Clamped<Box<[i64]>>) -> Self

Converts to this type from the input type.
Source§

impl From<Clamped<Box<[i8]>>> for JsValue

Source§

fn from(vector: Clamped<Box<[i8]>>) -> Self

Converts to this type from the input type.
Source§

impl From<Clamped<Box<[u16]>>> for JsValue

Source§

fn from(vector: Clamped<Box<[u16]>>) -> Self

Converts to this type from the input type.
Source§

impl From<Clamped<Box<[u32]>>> for JsValue

Source§

fn from(vector: Clamped<Box<[u32]>>) -> Self

Converts to this type from the input type.
Source§

impl From<Clamped<Box<[u64]>>> for JsValue

Source§

fn from(vector: Clamped<Box<[u64]>>) -> Self

Converts to this type from the input type.
Source§

impl From<Clamped<Box<[u8]>>> for JsValue

Source§

fn from(vector: Clamped<Box<[u8]>>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Clamped<Vec<T>>> for JsValue

Source§

fn from(vector: Clamped<Vec<T>>) -> Self

Converts to this type from the input type.
Source§

impl From<JsError> for JsValue

Source§

fn from(error: JsError) -> Self

Converts to this type from the input type.
Source§

impl<T> From<NonNull<T>> for JsValue

Source§

fn from(s: NonNull<T>) -> JsValue

Converts to this type from the input type.
Source§

impl<T> From<Option<T>> for JsValue
where JsValue: From<T>,

Source§

fn from(s: Option<T>) -> JsValue

Converts to this type from the input type.
Source§

impl From<String> for JsValue

Source§

fn from(s: String) -> JsValue

Converts to this type from the input type.
Source§

impl<T> From<Vec<T>> for JsValue
where JsValue: From<Box<[T]>>,

Source§

fn from(vector: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for JsValue

Source§

fn from(s: bool) -> JsValue

Converts to this type from the input type.
Source§

impl From<f32> for JsValue

Source§

fn from(n: f32) -> JsValue

Converts to this type from the input type.
Source§

impl From<f64> for JsValue

Source§

fn from(n: f64) -> JsValue

Converts to this type from the input type.
Source§

impl From<i128> for JsValue

Source§

fn from(n: i128) -> JsValue

Converts to this type from the input type.
Source§

impl From<i16> for JsValue

Source§

fn from(n: i16) -> JsValue

Converts to this type from the input type.
Source§

impl From<i32> for JsValue

Source§

fn from(n: i32) -> JsValue

Converts to this type from the input type.
Source§

impl From<i64> for JsValue

Source§

fn from(n: i64) -> JsValue

Converts to this type from the input type.
Source§

impl From<i8> for JsValue

Source§

fn from(n: i8) -> JsValue

Converts to this type from the input type.
Source§

impl From<isize> for JsValue

Source§

fn from(n: isize) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for JsValue

Source§

fn from(n: u128) -> JsValue

Converts to this type from the input type.
Source§

impl From<u16> for JsValue

Source§

fn from(n: u16) -> JsValue

Converts to this type from the input type.
Source§

impl From<u32> for JsValue

Source§

fn from(n: u32) -> JsValue

Converts to this type from the input type.
Source§

impl From<u64> for JsValue

Source§

fn from(n: u64) -> JsValue

Converts to this type from the input type.
Source§

impl From<u8> for JsValue

Source§

fn from(n: u8) -> JsValue

Converts to this type from the input type.
Source§

impl From<usize> for JsValue

Source§

fn from(n: usize) -> Self

Converts to this type from the input type.
Source§

impl FromWasmAbi for JsValue

Source§

type Abi = u32

The Wasm ABI type that this converts from when coming back out from the ABI boundary.
Source§

unsafe fn from_abi(js: u32) -> JsValue

Recover a Self from Self::Abi. Read more
Source§

impl IntoWasmAbi for &JsValue

Source§

type Abi = u32

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> u32

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl IntoWasmAbi for JsValue

Source§

type Abi = u32

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> u32

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl JsCast for JsValue

Source§

fn instanceof(_val: &JsValue) -> bool

Performs a dynamic instanceof check to see whether the JsValue provided is an instance of this type. Read more
Source§

fn unchecked_from_js(val: JsValue) -> Self

Performs a zero-cost unchecked conversion from a JsValue into an instance of Self Read more
Source§

fn unchecked_from_js_ref(val: &JsValue) -> &Self

Performs a zero-cost unchecked conversion from a &JsValue into an instance of &Self. Read more
Source§

fn has_type<T>(&self) -> bool
where T: JsCast,

Test whether this JS value has a type T. Read more
Source§

fn dyn_into<T>(self) -> Result<T, Self>
where T: JsCast,

Performs a dynamic cast (checked at runtime) of this value into the target type T. Read more
Source§

fn dyn_ref<T>(&self) -> Option<&T>
where T: JsCast,

Performs a dynamic cast (checked at runtime) of this value into the target type T. Read more
Source§

fn unchecked_into<T>(self) -> T
where T: JsCast,

Performs a zero-cost unchecked cast into the specified type. Read more
Source§

fn unchecked_ref<T>(&self) -> &T
where T: JsCast,

Performs a zero-cost unchecked cast into a reference to the specified type. Read more
Source§

fn is_instance_of<T>(&self) -> bool
where T: JsCast,

Test whether this JS value is an instance of the type T. Read more
Source§

fn is_type_of(val: &JsValue) -> bool

Performs a dynamic check to see whether the JsValue provided is a value of this type. Read more
Source§

impl LongRefFromWasmAbi for JsValue

Source§

type Abi = u32

Same as RefFromWasmAbi::Abi
Source§

type Anchor = JsValue

Same as RefFromWasmAbi::Anchor
Source§

unsafe fn long_ref_from_abi(js: u32) -> Self::Anchor

Same as RefFromWasmAbi::ref_from_abi
Source§

impl Mul<&JsValue> for JsValue

Source§

type Output = <&'static JsValue as Mul>::Output

The resulting type after applying the * operator.
Source§

fn mul( self, other: &JsValue, ) -> <&'static JsValue as Mul<&'static JsValue>>::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<JsValue> for &'a JsValue

Source§

type Output = <&'static JsValue as Mul>::Output

The resulting type after applying the * operator.
Source§

fn mul( self, other: JsValue, ) -> <&'static JsValue as Mul<&'static JsValue>>::Output

Performs the * operation. Read more
Source§

impl Mul for &JsValue

Source§

fn mul(self, rhs: Self) -> Self::Output

Applies the binary * JS operator on two JsValues.

MDN documentation

Source§

type Output = JsValue

The resulting type after applying the * operator.
Source§

impl Mul for JsValue

Source§

type Output = <&'static JsValue as Mul>::Output

The resulting type after applying the * operator.
Source§

fn mul( self, other: JsValue, ) -> <&'static JsValue as Mul<&'static JsValue>>::Output

Performs the * operation. Read more
Source§

impl Neg for &JsValue

Source§

fn neg(self) -> Self::Output

Applies the unary - JS operator on a JsValue.

MDN documentation

Source§

type Output = JsValue

The resulting type after applying the - operator.
Source§

impl Neg for JsValue

Source§

type Output = <&'static JsValue as Neg>::Output

The resulting type after applying the - operator.
Source§

fn neg(self) -> <&'static JsValue as Neg>::Output

Performs the unary - operation. Read more
Source§

impl Not for &JsValue

Source§

fn not(self) -> Self::Output

Applies the ! JS operator on a JsValue.

MDN documentation

Source§

type Output = bool

The resulting type after applying the ! operator.
Source§

impl Not for JsValue

Source§

type Output = <&'static JsValue as Not>::Output

The resulting type after applying the ! operator.
Source§

fn not(self) -> <&'static JsValue as Not>::Output

Performs the unary ! operation. Read more
Source§

impl<'a> PartialEq<&'a String> for JsValue

Source§

fn eq(&self, other: &&'a String) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<&'a str> for JsValue

Source§

fn eq(&self, other: &&'a str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<String> for JsValue

Source§

fn eq(&self, other: &String) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<bool> for JsValue

Source§

fn eq(&self, other: &bool) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<f32> for JsValue

Source§

fn eq(&self, other: &f32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<f64> for JsValue

Source§

fn eq(&self, other: &f64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i128> for JsValue

Source§

fn eq(&self, other: &i128) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i16> for JsValue

Source§

fn eq(&self, other: &i16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i32> for JsValue

Source§

fn eq(&self, other: &i32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i64> for JsValue

Source§

fn eq(&self, other: &i64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i8> for JsValue

Source§

fn eq(&self, other: &i8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<isize> for JsValue

Source§

fn eq(&self, other: &isize) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<str> for JsValue

Source§

fn eq(&self, other: &str) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u128> for JsValue

Source§

fn eq(&self, other: &u128) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u16> for JsValue

Source§

fn eq(&self, other: &u16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u32> for JsValue

Source§

fn eq(&self, other: &u32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u64> for JsValue

Source§

fn eq(&self, other: &u64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u8> for JsValue

Source§

fn eq(&self, other: &u8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<usize> for JsValue

Source§

fn eq(&self, other: &usize) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for JsValue

Source§

fn eq(&self, other: &Self) -> bool

Compares two JsValues for equality, using the === operator in JS.

MDN documentation

1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl RefFromWasmAbi for JsValue

Source§

type Abi = u32

The Wasm ABI type references to Self are recovered from.
Source§

type Anchor = ManuallyDrop<JsValue>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous.
Source§

unsafe fn ref_from_abi(js: u32) -> Self::Anchor

Recover a Self::Anchor from Self::Abi. Read more
Source§

impl Rem<&JsValue> for JsValue

Source§

type Output = <&'static JsValue as Rem>::Output

The resulting type after applying the % operator.
Source§

fn rem( self, other: &JsValue, ) -> <&'static JsValue as Rem<&'static JsValue>>::Output

Performs the % operation. Read more
Source§

impl<'a> Rem<JsValue> for &'a JsValue

Source§

type Output = <&'static JsValue as Rem>::Output

The resulting type after applying the % operator.
Source§

fn rem( self, other: JsValue, ) -> <&'static JsValue as Rem<&'static JsValue>>::Output

Performs the % operation. Read more
Source§

impl Rem for &JsValue

Source§

fn rem(self, rhs: Self) -> Self::Output

Applies the binary % JS operator on two JsValues.

MDN documentation

Source§

type Output = JsValue

The resulting type after applying the % operator.
Source§

impl Rem for JsValue

Source§

type Output = <&'static JsValue as Rem>::Output

The resulting type after applying the % operator.
Source§

fn rem( self, other: JsValue, ) -> <&'static JsValue as Rem<&'static JsValue>>::Output

Performs the % operation. Read more
Source§

impl Shl<&JsValue> for JsValue

Source§

type Output = <&'static JsValue as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl( self, other: &JsValue, ) -> <&'static JsValue as Shl<&'static JsValue>>::Output

Performs the << operation. Read more
Source§

impl<'a> Shl<JsValue> for &'a JsValue

Source§

type Output = <&'static JsValue as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl( self, other: JsValue, ) -> <&'static JsValue as Shl<&'static JsValue>>::Output

Performs the << operation. Read more
Source§

impl Shl for &JsValue

Source§

fn shl(self, rhs: Self) -> Self::Output

Applies the binary << JS operator on two JsValues.

MDN documentation

Source§

type Output = JsValue

The resulting type after applying the << operator.
Source§

impl Shl for JsValue

Source§

type Output = <&'static JsValue as Shl>::Output

The resulting type after applying the << operator.
Source§

fn shl( self, other: JsValue, ) -> <&'static JsValue as Shl<&'static JsValue>>::Output

Performs the << operation. Read more
Source§

impl Shr<&JsValue> for JsValue

Source§

type Output = <&'static JsValue as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr( self, other: &JsValue, ) -> <&'static JsValue as Shr<&'static JsValue>>::Output

Performs the >> operation. Read more
Source§

impl<'a> Shr<JsValue> for &'a JsValue

Source§

type Output = <&'static JsValue as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr( self, other: JsValue, ) -> <&'static JsValue as Shr<&'static JsValue>>::Output

Performs the >> operation. Read more
Source§

impl Shr for &JsValue

Source§

fn shr(self, rhs: Self) -> Self::Output

Applies the binary >> JS operator on two JsValues.

MDN documentation

Source§

type Output = JsValue

The resulting type after applying the >> operator.
Source§

impl Shr for JsValue

Source§

type Output = <&'static JsValue as Shr>::Output

The resulting type after applying the >> operator.
Source§

fn shr( self, other: JsValue, ) -> <&'static JsValue as Shr<&'static JsValue>>::Output

Performs the >> operation. Read more
Source§

impl Sub<&JsValue> for JsValue

Source§

type Output = <&'static JsValue as Sub>::Output

The resulting type after applying the - operator.
Source§

fn sub( self, other: &JsValue, ) -> <&'static JsValue as Sub<&'static JsValue>>::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<JsValue> for &'a JsValue

Source§

type Output = <&'static JsValue as Sub>::Output

The resulting type after applying the - operator.
Source§

fn sub( self, other: JsValue, ) -> <&'static JsValue as Sub<&'static JsValue>>::Output

Performs the - operation. Read more
Source§

impl Sub for &JsValue

Source§

fn sub(self, rhs: Self) -> Self::Output

Applies the binary - JS operator on two JsValues.

MDN documentation

Source§

type Output = JsValue

The resulting type after applying the - operator.
Source§

impl Sub for JsValue

Source§

type Output = <&'static JsValue as Sub>::Output

The resulting type after applying the - operator.
Source§

fn sub( self, other: JsValue, ) -> <&'static JsValue as Sub<&'static JsValue>>::Output

Performs the - operation. Read more
Source§

impl TryFrom<&JsValue> for f64

Source§

fn try_from(val: &JsValue) -> Result<Self, Self::Error>

Applies the unary + JS operator on a JsValue. Returns the numeric result on success, or the JS error value on error.

MDN documentation

Source§

type Error = JsValue

The type returned in the event of a conversion error.
Source§

impl TryFrom<JsValue> for String

Source§

type Error = JsValue

The type returned in the event of a conversion error.
Source§

fn try_from(value: JsValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<JsValue> for f64

Source§

fn try_from(val: JsValue) -> Result<Self, Self::Error>

Applies the unary + JS operator on a JsValue. Returns the numeric result on success, or the JS error value on error.

MDN documentation

Source§

type Error = JsValue

The type returned in the event of a conversion error.
Source§

impl TryFrom<JsValue> for i128

Source§

type Error = JsValue

The type returned in the event of a conversion error.
Source§

fn try_from(v: JsValue) -> Result<Self, JsValue>

Performs the conversion.
Source§

impl TryFrom<JsValue> for i64

Source§

type Error = JsValue

The type returned in the event of a conversion error.
Source§

fn try_from(v: JsValue) -> Result<Self, JsValue>

Performs the conversion.
Source§

impl TryFrom<JsValue> for u128

Source§

type Error = JsValue

The type returned in the event of a conversion error.
Source§

fn try_from(v: JsValue) -> Result<Self, JsValue>

Performs the conversion.
Source§

impl TryFrom<JsValue> for u64

Source§

type Error = JsValue

The type returned in the event of a conversion error.
Source§

fn try_from(v: JsValue) -> Result<Self, JsValue>

Performs the conversion.
Source§

impl VectorFromWasmAbi for JsValue

Source§

impl VectorIntoWasmAbi for JsValue

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ReturnWasmAbi for T
where T: IntoWasmAbi,

Source§

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi
Source§

fn return_abi(self) -> <T as ReturnWasmAbi>::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.