pub struct CallbackEnv<'id> { /* private fields */ }Expand description
The environment handed to resource callbacks (destructor, monitor-down, …).
Implementations§
Source§impl CallbackEnv<'_>
impl CallbackEnv<'_>
Sourcepub unsafe fn with_raw<R>(
raw: *mut Env,
f: impl for<'id> FnOnce(CallbackEnv<'id>) -> R,
) -> R
pub unsafe fn with_raw<R>( raw: *mut Env, f: impl for<'id> FnOnce(CallbackEnv<'id>) -> R, ) -> R
Enter a resource callback with a freshly branded CallbackEnv.
§Safety
raw must be the live env pointer the VM supplied for this callback.
Trait Implementations§
impl<'id> CallingEnv<'id> for CallbackEnv<'id>
Source§impl<'id> Clone for CallbackEnv<'id>
impl<'id> Clone for CallbackEnv<'id>
Source§fn clone(&self) -> CallbackEnv<'id>
fn clone(&self) -> CallbackEnv<'id>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'id> Copy for CallbackEnv<'id>
Source§impl<'id> Env<'id> for CallbackEnv<'id>
impl<'id> Env<'id> for CallbackEnv<'id>
Source§fn as_any_env(self) -> AnyEnv<'id>
fn as_any_env(self) -> AnyEnv<'id>
The kind-erased handle terms are built against. Every env kind downcasts
to the same
AnyEnv for a given brand.Source§fn term_type(self, term: impl Term<'id>) -> Option<TermType>
fn term_type(self, term: impl Term<'id>) -> Option<TermType>
The dynamic type of
term (enif_term_type). None for a type code
this otter build does not recognize (a newer-OTP type).Source§fn hash(self, algorithm: Hash, term: impl Term<'id>, salt: u64) -> u64
fn hash(self, algorithm: Hash, term: impl Term<'id>, salt: u64) -> u64
Hash a term (
enif_hash). algorithm is Phash2 (portable) or
InternalHash (node-local, faster).Source§fn consume_timeslice(self, percent: i32) -> bool
fn consume_timeslice(self, percent: i32) -> bool
Tell the scheduler how much of the timeslice this NIF used
(
enif_consume_timeslice). true if the timeslice is exhausted.Source§fn is_current_process_alive(self) -> bool
fn is_current_process_alive(self) -> bool
Whether the calling process is still alive
(
enif_is_current_process_alive).Source§fn make_unique_integer(self, properties: UniqueInteger) -> Integer<'id>
fn make_unique_integer(self, properties: UniqueInteger) -> Integer<'id>
Create a unique integer (
enif_make_unique_integer). properties is a
bitmask of UniqueInteger::POSITIVE / MONOTONIC.Auto Trait Implementations§
impl<'id> !Send for CallbackEnv<'id>
impl<'id> !Sync for CallbackEnv<'id>
impl<'id> Freeze for CallbackEnv<'id>
impl<'id> RefUnwindSafe for CallbackEnv<'id>
impl<'id> Unpin for CallbackEnv<'id>
impl<'id> UnsafeUnpin for CallbackEnv<'id>
impl<'id> UnwindSafe for CallbackEnv<'id>
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