Skip to main content

Module context

Module context 

Source
Expand description

Context management patterns

This module provides thread-safe context management for WASM and native environments. Contexts are used to propagate information across function calls without explicit parameter passing.

§Key Features

  • Thread-Local Context: WASM-compatible thread-local storage
  • Scoped Context: Automatic context cleanup with RAII
  • Context Inheritance: Child contexts inherit from parent contexts
  • Type Safety: Strongly typed context values
  • Performance: Zero-cost abstractions with compile-time optimization

Structs§

ContextKey
Context key for type-safe context access
GlobalContext
Global context manager for shared state
HashMapContext
Simple hash map based context manager
ThreadLocalContext
Thread-local context storage

Traits§

ContextManager
Context manager trait for different context implementations

Functions§

clear_context
Clear all values from the global thread-local context
get_context
Get a typed value from the global thread-local context
remove_context
Remove a typed value from the global thread-local context
scoped_context
Create a scoped context guard for the global thread-local context
set_context
Set a typed value in the global thread-local context
with_context_value
Execute a function with a scoped context value