Struct Context

Source
#[repr(C)]
pub struct Context { /* private fields */ }
Expand description

Opaque context structure that matches AtomVM’s internal representation

Trait Implementations§

Source§

impl ContextExt for Context

Source§

unsafe fn set_platform_data(&mut self, data: *mut c_void)

Set platform-specific data in the context
Source§

unsafe fn get_platform_data(&self) -> *mut c_void

Get platform-specific data from the context
Source§

unsafe fn set_user_data(&mut self, data: u64)

Set user data (for storing Erlang terms as raw u64)
Source§

unsafe fn get_user_data(&self) -> u64

Get user data
Source§

unsafe fn get_platform_data_as<T>(&self) -> *mut T

Safely cast platform data to a specific type
Source§

unsafe fn set_platform_data_box<T>(&mut self, data: Box<T>)

Safely set platform data from a boxed value
Source§

unsafe fn take_platform_data_box<T>(&mut self) -> Option<Box<T>>

Safely take ownership of platform data back as a box
Source§

unsafe fn set_user_term(&mut self, term: Term)

Set user data from a Term
Source§

unsafe fn get_user_term(&self) -> Term

Get user data as a Term
Source§

fn has_platform_data(&self) -> bool

Check if platform data is set
Source§

fn has_user_data(&self) -> bool

Check if user data is set

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.