[−][src]Struct nj_core::val::JsEnv
Implementations
impl JsEnv
[src]
pub fn new(env: napi_env) -> Self
[src]
pub fn inner(&self) -> napi_env
[src]
pub fn create_string_utf8(&self, r_string: &str) -> Result<napi_value, NjError>
[src]
pub fn create_string_utf8_from_bytes(
&self,
r_string: &[u8]
) -> Result<napi_value, NjError>
[src]
&self,
r_string: &[u8]
) -> Result<napi_value, NjError>
pub fn create_double(&self, value: f64) -> Result<napi_value, NjError>
[src]
pub fn create_int64(&self, value: i64) -> Result<napi_value, NjError>
[src]
pub fn create_int32(&self, value: i32) -> Result<napi_value, NjError>
[src]
pub fn create_bigint_uint64(&self, value: u64) -> Result<napi_value, NjError>
[src]
pub fn create_object(&self) -> Result<napi_value, NjError>
[src]
pub fn create_boolean(&self, value: bool) -> Result<napi_value, NjError>
[src]
pub fn create_array_with_len(&self, len: usize) -> Result<napi_value, NjError>
[src]
pub fn set_element(
&self,
object: napi_value,
element: napi_value,
index: usize
) -> Result<(), NjError>
[src]
&self,
object: napi_value,
element: napi_value,
index: usize
) -> Result<(), NjError>
pub fn get_element(
&self,
array: napi_value,
index: u32
) -> Result<napi_value, NjError>
[src]
&self,
array: napi_value,
index: u32
) -> Result<napi_value, NjError>
pub fn is_array(&self, array: napi_value) -> Result<bool, NjError>
[src]
check if napi value is array
pub fn is_array_buffer(&self, array: napi_value) -> Result<bool, NjError>
[src]
check if napi value is array buffer
pub fn is_buffer(&self, n_value: napi_value) -> Result<bool, NjError>
[src]
pub fn is_date(&self, n_value: napi_value) -> Result<bool, NjError>
[src]
pub fn is_error(&self, n_value: napi_value) -> Result<bool, NjError>
[src]
pub fn get_global(&self) -> Result<napi_value, NjError>
[src]
pub fn call_function(
&self,
recv: napi_value,
func: napi_value,
argv: Vec<napi_value>
) -> Result<napi_value, NjError>
[src]
&self,
recv: napi_value,
func: napi_value,
argv: Vec<napi_value>
) -> Result<napi_value, NjError>
pub fn get_cb_info(
&self,
info: napi_callback_info,
max_count: usize
) -> Result<JsCallback, NjError>
[src]
&self,
info: napi_callback_info,
max_count: usize
) -> Result<JsCallback, NjError>
get callback information
pub fn define_class(
&self,
name: &str,
constructor: napi_callback_raw,
properties: PropertiesBuilder
) -> Result<napi_value, NjError>
[src]
&self,
name: &str,
constructor: napi_callback_raw,
properties: PropertiesBuilder
) -> Result<napi_value, NjError>
define classes
pub fn create_reference(
&self,
cons: napi_value,
count: u32
) -> Result<napi_ref, NjError>
[src]
&self,
cons: napi_value,
count: u32
) -> Result<napi_ref, NjError>
pub fn delete_reference(&self, ref_: napi_ref) -> Result<(), NjError>
[src]
pub fn get_new_target(
&self,
info: napi_callback_info
) -> Result<napi_value, NjError>
[src]
&self,
info: napi_callback_info
) -> Result<napi_value, NjError>
pub fn wrap(
&self,
js_object: napi_value,
rust_obj: *mut u8,
finalize: napi_finalize_raw
) -> Result<napi_ref, NjError>
[src]
&self,
js_object: napi_value,
rust_obj: *mut u8,
finalize: napi_finalize_raw
) -> Result<napi_ref, NjError>
pub fn unwrap<T>(&self, js_this: napi_value) -> Result<&'static T, NjError>
[src]
pub fn unwrap_mut<T>(
&self,
js_this: napi_value
) -> Result<&'static mut T, NjError>
[src]
&self,
js_this: napi_value
) -> Result<&'static mut T, NjError>
pub fn new_instance(
&self,
constructor: napi_value,
args: Vec<napi_value>
) -> Result<napi_value, NjError>
[src]
&self,
constructor: napi_value,
args: Vec<napi_value>
) -> Result<napi_value, NjError>
pub fn get_reference_value(
&self,
obj_ref: napi_ref
) -> Result<napi_value, NjError>
[src]
&self,
obj_ref: napi_ref
) -> Result<napi_value, NjError>
pub fn create_promise(&self) -> Result<(napi_value, napi_deferred), NjError>
[src]
create promise and deferred
pub fn resolve_deferred(
&self,
deferred: napi_deferred,
resolution: napi_value
) -> Result<(), NjError>
[src]
&self,
deferred: napi_deferred,
resolution: napi_value
) -> Result<(), NjError>
pub fn reject_deferred(
&self,
deferred: napi_deferred,
rejection: napi_value
) -> Result<(), NjError>
[src]
&self,
deferred: napi_deferred,
rejection: napi_value
) -> Result<(), NjError>
pub fn create_thread_safe_function(
&self,
name: &str,
js_func: Option<napi_value>,
call_js_cb: napi_threadsafe_function_call_js
) -> Result<ThreadSafeFunction, NjError>
[src]
&self,
name: &str,
js_func: Option<napi_value>,
call_js_cb: napi_threadsafe_function_call_js
) -> Result<ThreadSafeFunction, NjError>
pub fn is_exception_pending(&self) -> bool
[src]
pub fn throw_type_error(&self, message: &str)
[src]
pub fn create_error(&self, message: &str) -> Result<napi_value, NjError>
[src]
pub fn value_type(
&self,
napi_value: napi_value
) -> Result<napi_valuetype, NjError>
[src]
&self,
napi_value: napi_value
) -> Result<napi_valuetype, NjError>
get value type
pub fn value_type_string(
&self,
napi_value: napi_value
) -> Result<&'static str, NjError>
[src]
&self,
napi_value: napi_value
) -> Result<&'static str, NjError>
get string representation of value type
pub fn assert_type(
&self,
napi_value: napi_value,
should_be_type: napi_valuetype
) -> Result<(), NjError>
[src]
&self,
napi_value: napi_value,
should_be_type: napi_valuetype
) -> Result<(), NjError>
assert that napi value is certain type, otherwise raise exception
pub fn convert_to_rust<'a, T>(
&'a self,
napi_value: napi_value
) -> Result<T, NjError> where
T: JSValue<'a>,
[src]
&'a self,
napi_value: napi_value
) -> Result<T, NjError> where
T: JSValue<'a>,
convert napi value to rust value
pub fn get_undefined(&self) -> Result<napi_value, NjError>
[src]
pub fn get_buffer_info(&self, napi_value: napi_value) -> Result<&[u8], NjError>
[src]
get buffer info
pub fn detach_arraybuffer(&self, napi_value: napi_value) -> Result<(), NjError>
[src]
Detach ArrayBuffer
pub fn is_detached_arraybuffer(
&self,
napi_value: napi_value
) -> Result<bool, NjError>
[src]
&self,
napi_value: napi_value
) -> Result<bool, NjError>
Is this ArrayBuffer Detached?
pub unsafe fn add_env_clean_up_hook(
&self,
init_func: Option<unsafe extern "C" fn(arg: *mut c_void)>,
arg: *mut c_void
) -> Result<(), NjError>
[src]
&self,
init_func: Option<unsafe extern "C" fn(arg: *mut c_void)>,
arg: *mut c_void
) -> Result<(), NjError>
Trait Implementations
impl Clone for JsEnv
[src]
impl Copy for JsEnv
[src]
impl Debug for JsEnv
[src]
impl<'_> ExtractArgFromJs<'_> for JsEnv
[src]
pub fn convert_arg_at(
js_cb: &JsCallback,
_index: usize
) -> Result<Self, NjError>
[src]
js_cb: &JsCallback,
_index: usize
) -> Result<Self, NjError>
pub fn label() -> &'static str
[src]
impl<'_> ExtractFromJs<'_> for JsEnv
[src]
pub fn extract(js_cb: &mut JsCallback) -> Result<Self, NjError>
[src]
pub fn label() -> &'static str
[src]
impl From<*mut napi_env__> for JsEnv
[src]
impl Send for JsEnv
[src]
impl Sync for JsEnv
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,