Struct node_bindgen::core::val::JsCallback
source · pub struct JsCallback { /* private fields */ }Implementations§
source§impl JsCallback
impl JsCallback
pub fn new(
env: JsEnv,
this: *mut napi_value__,
args: Vec<*mut napi_value__, Global>
) -> JsCallback
pub fn env(&self) -> &JsEnv
pub fn args(&self, index: usize) -> *mut napi_value__
pub fn this(&self) -> *mut napi_value__
pub fn this_owned(self) -> *mut napi_value__
pub fn remove_napi(&mut self) -> Option<*mut 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: Option<unsafe extern "C" fn(_: *mut napi_env__, _: *mut napi_value__, _: *mut c_void, _: *mut c_void)>
) -> Result<ThreadSafeFunction, NjError>
pub fn create_thread_safe_function(
&mut self,
name: &str,
call_js_cb: Option<unsafe extern "C" fn(_: *mut napi_env__, _: *mut napi_value__, _: *mut c_void, _: *mut c_void)>
) -> Result<ThreadSafeFunction, NjError>
create thread safe function
sourcepub fn create_thread_safe_function_at(
&self,
name: &str,
index: usize,
call_js_cb: Option<unsafe extern "C" fn(_: *mut napi_env__, _: *mut napi_value__, _: *mut c_void, _: *mut c_void)>
) -> Result<ThreadSafeFunction, NjError>
pub fn create_thread_safe_function_at(
&self,
name: &str,
index: usize,
call_js_cb: Option<unsafe extern "C" fn(_: *mut napi_env__, _: *mut napi_value__, _: *mut c_void, _: *mut c_void)>
) -> 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 more