pub struct Unknown<'env>(/* private fields */);Expand description
Represents a raw JavaScript value
Implementations§
Source§impl Unknown<'_>
impl Unknown<'_>
pub fn get_type(&self) -> Result<ValueType>
Sourcepub unsafe fn cast<V>(&self) -> Result<V>where
V: FromNapiValue,
pub unsafe fn cast<V>(&self) -> Result<V>where
V: FromNapiValue,
§Safety
This function should be called after JsUnknown::get_type
And the V must be match with the return value of get_type
Sourcepub unsafe fn from_raw_unchecked(env: napi_env, value: napi_value) -> Self
pub unsafe fn from_raw_unchecked(env: napi_env, value: napi_value) -> Self
§Safety
Unknown doesn’t have a type
Sourcepub fn create_ref(&self) -> Result<UnknownRef>
pub fn create_ref(&self) -> Result<UnknownRef>
Create a reference to the unknown value
Trait Implementations§
Source§impl FromNapiValue for Unknown<'_>
impl FromNapiValue for Unknown<'_>
Source§unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
Safety Read more
fn from_unknown(value: Unknown<'_>) -> Result<Self>
Source§impl<'env> JsValue<'env> for Unknown<'env>
impl<'env> JsValue<'env> for Unknown<'env>
fn value(&self) -> Value
fn raw(&self) -> napi_value
Source§fn to_unknown(&self) -> Unknown<'env>
fn to_unknown(&self) -> Unknown<'env>
Convert the value to an unknown
Source§fn 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>
Source§impl TryFrom<Unknown<'_>> for JsArrayBuffer
impl TryFrom<Unknown<'_>> for JsArrayBuffer
Source§impl TryFrom<Unknown<'_>> for JsDataView
impl TryFrom<Unknown<'_>> for JsDataView
Source§impl TryFrom<Unknown<'_>> for JsFunction
impl TryFrom<Unknown<'_>> for JsFunction
Source§impl TryFrom<Unknown<'_>> for JsTypedArray
impl TryFrom<Unknown<'_>> for JsTypedArray
Source§impl TryFrom<Unknown<'_>> for JsUndefined
impl TryFrom<Unknown<'_>> for JsUndefined
Source§impl ValidateNapiValue for Unknown<'_>
impl ValidateNapiValue for Unknown<'_>
Source§unsafe fn validate(_env: napi_env, _napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(_env: napi_env, _napi_val: napi_value) -> Result<napi_value>
Safety Read more
impl<'env> Copy for Unknown<'env>
Auto Trait Implementations§
impl<'env> Freeze for Unknown<'env>
impl<'env> RefUnwindSafe for Unknown<'env>
impl<'env> !Send for Unknown<'env>
impl<'env> !Sync for Unknown<'env>
impl<'env> Unpin for Unknown<'env>
impl<'env> UnwindSafe for Unknown<'env>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'env, T> JsValuesTuple for Twhere
T: JsValue<'env>,
impl<'env, T> JsValuesTuple for Twhere
T: JsValue<'env>,
fn env(&self) -> *mut napi_env__
Source§impl<T> JsValuesTupleIntoVec for Twhere
T: ToNapiValue,
impl<T> JsValuesTupleIntoVec for Twhere
T: ToNapiValue,
fn into_vec(self, env: *mut napi_env__) -> Result<Vec<*mut napi_value__>, Error>
Source§impl<'env, T> ToNapiValue for Twhere
T: JsValue<'env>,
impl<'env, T> ToNapiValue for Twhere
T: JsValue<'env>,
Source§unsafe fn to_napi_value(
_env: *mut napi_env__,
val: T,
) -> Result<*mut napi_value__, Error>
unsafe fn to_napi_value( _env: *mut napi_env__, val: T, ) -> Result<*mut napi_value__, Error>
Safety Read more