pub struct NapiRef(/* private fields */);
Implementations§
Source§impl NapiRef
impl NapiRef
Sourcepub fn new<T: NapiValueT>(value: T, count: u32) -> NapiResult<NapiRef>
pub fn new<T: NapiValueT>(value: T, count: u32) -> NapiResult<NapiRef>
This API creates a new reference with the specified reference count to the Object passed in.
Sourcepub fn inc(&mut self) -> NapiResult<u32>
pub fn inc(&mut self) -> NapiResult<u32>
This API increments the reference count for the reference passed in and returns the resulting reference count.
Sourcepub fn dec(&mut self) -> NapiResult<u32>
pub fn dec(&mut self) -> NapiResult<u32>
This API decrements the reference count for the reference passed in and returns the resulting reference count.
Sourcepub fn deref<T: NapiValueT>(&self) -> NapiResult<T>
pub fn deref<T: NapiValueT>(&self) -> NapiResult<T>
If still valid, this API returns the napi_value representing the JavaScript Object associated with the napi_ref. Otherwise, result will be NULL.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NapiRef
impl RefUnwindSafe for NapiRef
impl !Send for NapiRef
impl !Sync for NapiRef
impl Unpin for NapiRef
impl UnwindSafe for NapiRef
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