Struct nj_core::val::JsCallback
source · pub struct JsCallback { /* private fields */ }
Implementations§
source§impl JsCallback
impl JsCallback
pub fn new(env: JsEnv, this: napi_value, args: Vec<napi_value>) -> Self
pub fn env(&self) -> &JsEnv
pub fn args(&self, index: usize) -> napi_value
pub fn this(&self) -> napi_value
pub fn this_owned(self) -> napi_value
pub fn remove_napi(&mut self) -> Option<napi_value>
sourcepub fn get_value<'a, T>(&'a mut self) -> Result<T, NjError>where
T: ExtractFromJs<'a>,
pub fn get_value<'a, T>(&'a mut self) -> Result<T, NjError>where T: ExtractFromJs<'a>,
consume next napi value and remove them from arg list
sourcepub fn get_value_at<'a, T>(&'a self, index: usize) -> Result<T, NjError>where
T: ExtractArgFromJs<'a>,
pub fn get_value_at<'a, T>(&'a self, index: usize) -> Result<T, NjError>where T: ExtractArgFromJs<'a>,
convert value to rust
sourcepub fn create_thread_safe_function(
&mut self,
name: &str,
call_js_cb: napi_threadsafe_function_call_js
) -> Result<ThreadSafeFunction, NjError>
pub fn create_thread_safe_function( &mut self, name: &str, call_js_cb: napi_threadsafe_function_call_js ) -> Result<ThreadSafeFunction, NjError>
create thread safe function
sourcepub fn create_thread_safe_function_at(
&self,
name: &str,
index: usize,
call_js_cb: napi_threadsafe_function_call_js
) -> Result<ThreadSafeFunction, NjError>
pub fn create_thread_safe_function_at( &self, name: &str, index: usize, call_js_cb: napi_threadsafe_function_call_js ) -> Result<ThreadSafeFunction, NjError>
create thread safe function at
pub fn unwrap_mut<T>(&self) -> Result<&'static mut T, NjError>
pub fn unwrap<T>(&self) -> Result<&'static T, NjError>
Trait Implementations§
source§impl Clone for JsCallback
impl Clone for JsCallback
source§fn clone(&self) -> JsCallback
fn clone(&self) -> JsCallback
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for JsCallback
impl Debug for JsCallback
impl Send for JsCallback
impl Sync for JsCallback
Auto Trait Implementations§
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