Struct wasm_bindgen::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 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 fn undefined() -> JsValue

Creates a new JS value representing undefined.

source

pub 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 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§

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

Applies the binary + JS operator on two JsValues.

MDN documentation

§

type Output = JsValue

The resulting type after applying the + operator.
source§

impl Add<&JsValue> for JsValue

§

type Output = <&'static JsValue as Add<&'static JsValue>>::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

§

type Output = <&'static JsValue as Add<&'static JsValue>>::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<JsValue> for JsValue

§

type Output = <&'static JsValue as Add<&'static JsValue>>::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§

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

Applies the binary & JS operator on two JsValues.

MDN documentation

§

type Output = JsValue

The resulting type after applying the & operator.
source§

impl BitAnd<&JsValue> for JsValue

§

type Output = <&'static JsValue as BitAnd<&'static JsValue>>::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

§

type Output = <&'static JsValue as BitAnd<&'static JsValue>>::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<JsValue> for JsValue

§

type Output = <&'static JsValue as BitAnd<&'static JsValue>>::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§

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

Applies the binary | JS operator on two JsValues.

MDN documentation

§

type Output = JsValue

The resulting type after applying the | operator.
source§

impl BitOr<&JsValue> for JsValue

§

type Output = <&'static JsValue as BitOr<&'static JsValue>>::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

§

type Output = <&'static JsValue as BitOr<&'static JsValue>>::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<JsValue> for JsValue

§

type Output = <&'static JsValue as BitOr<&'static JsValue>>::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§

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

Applies the binary ^ JS operator on two JsValues.

MDN documentation

§

type Output = JsValue

The resulting type after applying the ^ operator.
source§

impl BitXor<&JsValue> for JsValue

§

type Output = <&'static JsValue as BitXor<&'static JsValue>>::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

§

type Output = <&'static JsValue as BitXor<&'static JsValue>>::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<JsValue> for JsValue

§

type Output = <&'static JsValue as BitXor<&'static JsValue>>::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§

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

Applies the binary / JS operator on two JsValues.

MDN documentation

§

type Output = JsValue

The resulting type after applying the / operator.
source§

impl Div<&JsValue> for JsValue

§

type Output = <&'static JsValue as Div<&'static JsValue>>::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

§

type Output = <&'static JsValue as Div<&'static JsValue>>::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<JsValue> for JsValue

§

type Output = <&'static JsValue as Div<&'static JsValue>>::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 JsValuewhere 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 From<JsError> for JsValue

source§

fn from(error: JsError) -> Self

Converts to this type from the input type.
source§

impl<T> From<Option<T>> for JsValuewhere 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 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

§

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<'a> IntoWasmAbi for &'a JsValue

§

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

§

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) -> boolwhere 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) -> Twhere T: JsCast,

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

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

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

fn is_instance_of<T>(&self) -> boolwhere 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

§

type Abi = u32

Same as RefFromWasmAbi::Abi
§

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§

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

Applies the binary * JS operator on two JsValues.

MDN documentation

§

type Output = JsValue

The resulting type after applying the * operator.
source§

impl Mul<&JsValue> for JsValue

§

type Output = <&'static JsValue as Mul<&'static JsValue>>::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

§

type Output = <&'static JsValue as Mul<&'static JsValue>>::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<JsValue> for JsValue

§

type Output = <&'static JsValue as Mul<&'static JsValue>>::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

§

type Output = JsValue

The resulting type after applying the - operator.
source§

impl Neg for JsValue

§

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

§

type Output = bool

The resulting type after applying the ! operator.
source§

impl Not for JsValue

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<JsValue> 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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl RefFromWasmAbi for JsValue

§

type Abi = u32

The wasm ABI type references to Self are recovered from.
§

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§

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

Applies the binary % JS operator on two JsValues.

MDN documentation

§

type Output = JsValue

The resulting type after applying the % operator.
source§

impl Rem<&JsValue> for JsValue

§

type Output = <&'static JsValue as Rem<&'static JsValue>>::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

§

type Output = <&'static JsValue as Rem<&'static JsValue>>::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<JsValue> for JsValue

§

type Output = <&'static JsValue as Rem<&'static JsValue>>::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§

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

Applies the binary << JS operator on two JsValues.

MDN documentation

§

type Output = JsValue

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

impl Shl<&JsValue> for JsValue

§

type Output = <&'static JsValue as Shl<&'static JsValue>>::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

§

type Output = <&'static JsValue as Shl<&'static JsValue>>::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<JsValue> for JsValue

§

type Output = <&'static JsValue as Shl<&'static JsValue>>::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§

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

Applies the binary >> JS operator on two JsValues.

MDN documentation

§

type Output = JsValue

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

impl Shr<&JsValue> for JsValue

§

type Output = <&'static JsValue as Shr<&'static JsValue>>::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

§

type Output = <&'static JsValue as Shr<&'static JsValue>>::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<JsValue> for JsValue

§

type Output = <&'static JsValue as Shr<&'static JsValue>>::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§

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

Applies the binary - JS operator on two JsValues.

MDN documentation

§

type Output = JsValue

The resulting type after applying the - operator.
source§

impl Sub<&JsValue> for JsValue

§

type Output = <&'static JsValue as Sub<&'static JsValue>>::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

§

type Output = <&'static JsValue as Sub<&'static JsValue>>::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<JsValue> for JsValue

§

type Output = <&'static JsValue as Sub<&'static JsValue>>::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

§

type Error = JsValue

The type returned in the event of a conversion error.
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

§

type Error = JsValue

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

impl TryFrom<JsValue> for i128

§

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

§

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

§

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

§

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.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: IntoWasmAbi,

§

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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.