pub struct JsIn<'a> { /* private fields */ }Expand description
A JS value borrowed for a call: read it with its methods, convert it
with super::JsValue::from_js.
Implementations§
Source§impl<'a> JsIn<'a>
impl<'a> JsIn<'a>
Sourcepub fn is_nullish(&self) -> bool
pub fn is_nullish(&self) -> bool
undefined or null.
Sourcepub fn array_len(&self) -> Result<Option<usize>, PropError>
pub fn array_len(&self) -> Result<Option<usize>, PropError>
Its length, if it is an array (an error when it is longer than the host reads in one call).
Sourcepub fn field(&self, key: &str) -> Result<JsOwned<'a>, PropError>
pub fn field(&self, key: &str) -> Result<JsOwned<'a>, PropError>
Its field key (undefined when it has none).
Sourcepub fn keys(&self) -> Result<Vec<String>, PropError>
pub fn keys(&self) -> Result<Vec<String>, PropError>
Its own enumerable string keys (none when it is not an object).
Sourcepub fn primitives(&self) -> Result<Option<Vec<JsPrimitive>>, PropError>
pub fn primitives(&self) -> Result<Option<Vec<JsPrimitive>>, PropError>
The items of the array it is, as primitives (None: not an array),
read in one call.
Sourcepub fn primitive_entries(&self) -> Result<Vec<(String, JsPrimitive)>, PropError>
pub fn primitive_entries(&self) -> Result<Vec<(String, JsPrimitive)>, PropError>
Its own enumerable string-keyed fields, as primitives (none when it is not an object), read in one call.
Sourcepub fn same_value(&self, other: JsIn<'_>) -> bool
pub fn same_value(&self, other: JsIn<'_>) -> bool
Whether it is other, as Object.is says (the same object, or
the same primitive: NaN is NaN, 0 is not -0).
Sourcepub fn as_buffer(&self) -> Option<Vec<u8>>
pub fn as_buffer(&self) -> Option<Vec<u8>>
The bytes of the ArrayBuffer, typed array or DataView it is,
copied.
Sourcepub fn iterate(&self) -> Result<Option<Vec<JsOwned<'a>>>, PropError>
pub fn iterate(&self) -> Result<Option<Vec<JsOwned<'a>>>, PropError>
The values it yields as an iterable, as for...of reads them (a
Map’s [key, value] pairs, a Set’s values; None: not
iterable).