pub trait JsValue<'env>: Sized + FromNapiValue {
Show 17 methods
// Required method
fn value(&self) -> Value;
// Provided methods
fn raw(&self) -> napi_value { ... }
fn to_unknown(&self) -> Unknown<'env> { ... }
fn coerce_to_bool(&self) -> Result<bool> { ... }
fn coerce_to_number(&self) -> Result<JsNumber<'_>> { ... }
fn coerce_to_string(&self) -> Result<JsString<'_>> { ... }
fn coerce_to_object(&self) -> Result<Object<'env>> { ... }
fn is_date(&self) -> Result<bool> { ... }
fn is_promise(&self) -> Result<bool> { ... }
fn is_error(&self) -> Result<bool> { ... }
fn is_typedarray(&self) -> Result<bool> { ... }
fn is_dataview(&self) -> Result<bool> { ... }
fn is_array(&self) -> Result<bool> { ... }
fn is_buffer(&self) -> Result<bool> { ... }
fn is_arraybuffer(&self) -> Result<bool> { ... }
fn instanceof<'c, Constructor>(
&self,
constructor: Constructor,
) -> Result<bool>
where Constructor: JsValue<'c> { ... }
fn escape<'scope, E: JsValue<'scope> + FromNapiValue>(
&self,
escapable_handle_scope: EscapableHandleScope<'scope>,
) -> Result<E> { ... }
}Required Methods§
Provided Methods§
fn raw(&self) -> napi_value
Sourcefn to_unknown(&self) -> Unknown<'env>
fn to_unknown(&self) -> Unknown<'env>
Convert the value to an unknown
Sourcefn coerce_to_bool(&self) -> Result<bool>
fn coerce_to_bool(&self) -> Result<bool>
Coerce the value to a boolean
fn coerce_to_number(&self) -> Result<JsNumber<'_>>
fn coerce_to_string(&self) -> Result<JsString<'_>>
fn coerce_to_object(&self) -> Result<Object<'env>>
fn is_date(&self) -> Result<bool>
fn is_promise(&self) -> Result<bool>
fn is_error(&self) -> Result<bool>
fn is_typedarray(&self) -> Result<bool>
fn is_dataview(&self) -> Result<bool>
fn is_array(&self) -> Result<bool>
fn is_buffer(&self) -> Result<bool>
fn is_arraybuffer(&self) -> Result<bool>
fn instanceof<'c, Constructor>(&self, constructor: Constructor) -> Result<bool>where
Constructor: JsValue<'c>,
fn escape<'scope, E: JsValue<'scope> + FromNapiValue>( &self, escapable_handle_scope: EscapableHandleScope<'scope>, ) -> Result<E>
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.