Module atom

Source
Expand description

AtomVM Atom Table Interface

This module provides safe Rust bindings to the AtomVM atom table, allowing Ports and NIFs to interact with the VM’s atom storage system.

§Design Philosophy

This module uses dependency injection throughout - no global state. All operations take an impl AtomTableOps parameter, making the code generic and testable with any atom table implementation.

§Examples

use avmnif_rs::atom::{AtomTableOps, AtomTable};

// In production - use real AtomVM table
let atom_table = AtomTable::new(context);
let hello_atom = atom_table.ensure_atom_str("hello")?;

// In testing - use mock table
let atom_table = MockAtomTable::new();
let hello_atom = atom_table.ensure_atom_str("hello")?;

// Both work the same way!

Modules§

atoms
Utilities for working with common atoms

Structs§

AtomIndex
Index into the atom table
AtomRef
Reference to atom data stored in the table
AtomTable
Opaque handle to the AtomVM atom table

Enums§

AtomCopyOpt
Copy options for atom insertion
AtomError
Errors that can occur during atom operations
EnsureAtomsOpt
Options for bulk atom operations

Traits§

AtomTableOps
Trait for atom table operations - the foundation of our generic design