Struct AtomTable

Source
pub struct AtomTable(/* private fields */);
Expand description

Opaque handle to the AtomVM atom table

Implementations§

Source§

impl AtomTable

Source

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

Source

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.

Source

pub unsafe fn as_raw(&self) -> *mut c_void

Get the raw pointer to the atom table

§Safety

The returned pointer should only be used with AtomVM C functions

Trait Implementations§

Source§

impl AtomTableOps for AtomTable

Source§

fn count(&self) -> usize

Get the number of atoms currently in the table
Source§

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>

Ensure an atom exists in the table, creating it if necessary
Source§

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

Check if an atom equals the given byte string
Source§

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>

Bulk insert/lookup atoms from encoded atom data
Source§

fn ensure_atom_str(&self, atom_str: &str) -> Result<AtomIndex, AtomError>

Ensure an atom exists using a string slice
Source§

fn find_atom_str(&self, atom_str: &str) -> Result<AtomIndex, AtomError>

Find an atom using a string slice
Source§

fn atom_equals_str(&self, atom_index: AtomIndex, s: &str) -> bool

Check if an atom equals the given string
Source§

impl Send for AtomTable

Source§

impl Sync for AtomTable

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.