Struct UnknownRef

Source
pub struct UnknownRef<const LEAK_CHECK: bool = true> { /* private fields */ }
Expand description

A reference to a unknown JavaScript value.

You must call the unref method to release the reference, or the object under the hood will be leaked forever.

Set the LEAK_CHECK to false to disable the leak check during the Drop

Implementations§

Source§

impl<const LEAK_CHECK: bool> UnknownRef<LEAK_CHECK>

Source

pub fn get_value(&self, env: &Env) -> Result<Unknown<'_>>

Get the object from the reference

Source

pub fn unref(self, env: &Env) -> Result<()>

Unref the reference

Trait Implementations§

Source§

impl<const LEAK_CHECK: bool> Drop for UnknownRef<LEAK_CHECK>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<const LEAK_CHECK: bool> FromNapiValue for UnknownRef<LEAK_CHECK>

Source§

unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>

Safety Read more
Source§

fn from_unknown(value: Unknown<'_>) -> Result<Self>

Source§

impl<const LEAK_CHECK: bool> ToNapiValue for &UnknownRef<LEAK_CHECK>

Source§

unsafe fn to_napi_value(env: napi_env, val: Self) -> Result<napi_value>

Safety Read more
Source§

fn into_unknown(self, env: &Env) -> Result<Unknown<'_>>

Source§

impl<const LEAK_CHECK: bool> ToNapiValue for UnknownRef<LEAK_CHECK>

Source§

unsafe fn to_napi_value(env: napi_env, val: Self) -> Result<napi_value>

Safety Read more
Source§

fn into_unknown(self, env: &Env) -> Result<Unknown<'_>>

Source§

impl<const LEAK_CHECK: bool> Send for UnknownRef<LEAK_CHECK>

Auto Trait Implementations§

§

impl<const LEAK_CHECK: bool> Freeze for UnknownRef<LEAK_CHECK>

§

impl<const LEAK_CHECK: bool> RefUnwindSafe for UnknownRef<LEAK_CHECK>

§

impl<const LEAK_CHECK: bool = true> !Sync for UnknownRef<LEAK_CHECK>

§

impl<const LEAK_CHECK: bool> Unpin for UnknownRef<LEAK_CHECK>

§

impl<const LEAK_CHECK: bool> UnwindSafe for UnknownRef<LEAK_CHECK>

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> 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> JsValuesTupleIntoVec for T
where T: ToNapiValue,

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.