pub struct AtomTable(/* private fields */);Expand description
Opaque handle to the AtomVM atom table
Implementations§
Source§impl AtomTable
impl AtomTable
Sourcepub unsafe fn from_raw(ptr: *mut c_void) -> Self
pub unsafe fn from_raw(ptr: *mut c_void) -> Self
Create an AtomTable from a raw pointer
§Safety
The pointer must be valid and point to a real AtomVM atom table
Sourcepub fn from_global() -> Self
pub fn from_global() -> Self
Create an AtomTable from the global AtomVM instance
This should only be used in production with a running AtomVM. For testing, use MockAtomTable instead.
Trait Implementations§
Source§impl AtomTableOps for AtomTable
impl AtomTableOps for AtomTable
Source§fn get_atom_string(&self, index: AtomIndex) -> Result<AtomRef<'_>, AtomError>
fn get_atom_string(&self, index: AtomIndex) -> Result<AtomRef<'_>, AtomError>
Get atom data by index
Source§fn ensure_atom(&self, atom_data: &[u8]) -> Result<AtomIndex, AtomError>
fn ensure_atom(&self, atom_data: &[u8]) -> Result<AtomIndex, AtomError>
Ensure an atom exists in the table, creating it if necessary
Source§fn find_atom(&self, atom_data: &[u8]) -> Result<AtomIndex, AtomError>
fn find_atom(&self, atom_data: &[u8]) -> Result<AtomIndex, AtomError>
Ensure an atom exists, but only if it already exists
Source§fn atom_equals(&self, atom_index: AtomIndex, data: &[u8]) -> bool
fn atom_equals(&self, atom_index: AtomIndex, data: &[u8]) -> bool
Check if an atom equals the given byte string
Source§fn compare_atoms(&self, atom1: AtomIndex, atom2: AtomIndex) -> i32
fn compare_atoms(&self, atom1: AtomIndex, atom2: AtomIndex) -> i32
Compare two atoms lexicographically
Source§fn ensure_atoms_bulk(
&self,
atoms_data: &[u8],
count: usize,
encoding: EnsureAtomsOpt,
) -> Result<Vec<AtomIndex>, AtomError>
fn ensure_atoms_bulk( &self, atoms_data: &[u8], count: usize, encoding: EnsureAtomsOpt, ) -> Result<Vec<AtomIndex>, AtomError>
Bulk insert/lookup atoms from encoded atom data
Source§fn ensure_atom_str(&self, atom_str: &str) -> Result<AtomIndex, AtomError>
fn ensure_atom_str(&self, atom_str: &str) -> Result<AtomIndex, AtomError>
Ensure an atom exists using a string slice
impl Send for AtomTable
impl Sync for AtomTable
Auto Trait Implementations§
impl Freeze for AtomTable
impl RefUnwindSafe for AtomTable
impl Unpin for AtomTable
impl UnwindSafe for AtomTable
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