Module context

Source
Expand description

Context management for AtomVM ports and NIFs

Provides safe wrappers around AtomVM’s context structures

Structs§

Context
Opaque context structure that matches AtomVM’s internal representation
ContextGuard
RAII wrapper for automatic context cleanup
ContextManager
Context manager for handling multiple contexts
PortBuilder
Port builder for ergonomic port creation

Traits§

ContextExt
Context extension trait for safe platform data management
PlatformData
Trait for types that can be stored as platform data

Functions§

cleanup_platform_data
Clean up platform data from a context
context_get_platform_data
Get platform data from context
context_get_user_data
Get user data from context (for storing Erlang terms)
context_set_platform_data
Set platform data in context
context_set_user_data
Set user data in context
create_port_context
Create a new port context
create_port_context_safe
Safe wrapper for creating port contexts
destroy_port_context
Destroy a port context and clean up resources
destroy_port_context_safe
Safe wrapper for destroying port contexts
get_global_context
Get the global context for ISR use
global_context_ptr
Get the global context pointer (for ISR use)
init_platform_data
Initialize platform data in a context
is_port_alive
Check if a port is still alive
port_is_alive
Check if a port is still alive
with_platform_data
Helper functions for common context operations Safely execute a function with platform data
with_platform_data_mut
Safely execute a function with mutable platform data

Type Aliases§

GlobalContext
Global AtomVM context