Struct deno_napi::Env

source ·
#[repr(C)]
pub struct Env { pub isolate_ptr: *mut OwnedIsolate, pub open_handle_scopes: usize, pub shared: *mut EnvShared, pub async_work_sender: UnboundedSender<PendingNapiAsyncWork>, pub threadsafe_function_sender: UnboundedSender<ThreadSafeFunctionStatus>, pub cleanup_hooks: Rc<RefCell<Vec<(extern "C" fn(_: *const c_void), *const c_void)>>>, pub tsfn_ref_counters: Arc<Mutex<ThreadsafeFunctionRefCounters>>, pub last_error: napi_extended_error_info, pub global: NonNull<Value>, /* private fields */ }

Fields§

§isolate_ptr: *mut OwnedIsolate§open_handle_scopes: usize§shared: *mut EnvShared§async_work_sender: UnboundedSender<PendingNapiAsyncWork>§threadsafe_function_sender: UnboundedSender<ThreadSafeFunctionStatus>§cleanup_hooks: Rc<RefCell<Vec<(extern "C" fn(_: *const c_void), *const c_void)>>>§tsfn_ref_counters: Arc<Mutex<ThreadsafeFunctionRefCounters>>§last_error: napi_extended_error_info§global: NonNull<Value>

Implementations§

source§

impl Env

source

pub fn new(
isolate_ptr: *mut OwnedIsolate,
context: Global<Context>,
global: Global<Value>,
sender: UnboundedSender<PendingNapiAsyncWork>,
threadsafe_function_sender: UnboundedSender<ThreadSafeFunctionStatus>,
cleanup_hooks: Rc<RefCell<Vec<(extern "C" fn(_: *const c_void), *const c_void)>>>,
tsfn_ref_counters: Arc<Mutex<ThreadsafeFunctionRefCounters>>
) -> Self

source

pub fn shared(&self) -> &EnvShared

source

pub fn shared_mut(&mut self) -> &mut EnvShared

source

pub fn add_async_work(&mut self, async_work: PendingNapiAsyncWork)

source

pub fn isolate(&mut self) -> &mut OwnedIsolate

source

pub fn scope(&self) -> CallbackScope<'_>

source

pub fn add_threadsafe_function_ref_counter(
&mut self,
id: usize,
counter: Arc<AtomicUsize>
)

source

pub fn remove_threadsafe_function_ref_counter(&mut self, id: usize)

Trait Implementations§

source§

impl Send for Env

source§

impl Sync for Env

Auto Trait Implementations§

§

impl !RefUnwindSafe for Env

§

impl Unpin for Env

§

impl !UnwindSafe for Env

Blanket Implementations§

source§

impl<T> Any for Twhere
T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
U: From<T>,

const: unstable · 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, U> TryFrom<U> for Twhere
U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.