register_atom_set

Macro register_atom_set 

Source
macro_rules! register_atom_set {
    ($atom_type:ty) => { ... };
}
Expand description

Registers a singleton DynAtomRegistry<T> for the given atom type.

This macro creates a static instance and implements the RegisteredAtomSet trait.

ยงExample

use css_lexer::{AtomSet, RegisteredAtomSet, register_atom_set};
use derive_atom_set::AtomSet as DeriveAtomSet;

#[derive(Debug, Default, Copy, Clone, PartialEq, DeriveAtomSet)]
enum MyAtoms {
    #[default]
    _None,
    Foo,
}

register_atom_set!(MyAtoms);

// Now you can use the singleton
let atoms = MyAtoms::get_dyn_set();
let atom = atoms.atom_from_str("foo");