avoid writing chars to the atom table in several places

This commit is contained in:
Mark Thom
2022-04-16 19:57:26 -06:00
parent b448681872
commit 2d5fe21b05
4 changed files with 31 additions and 160 deletions

View File

@@ -364,6 +364,18 @@ pub enum AtomOrString {
}
impl AtomOrString {
#[inline]
pub fn as_atom(&self, atom_tbl: &mut AtomTable) -> Atom {
match self {
&AtomOrString::Atom(atom) => {
atom
}
AtomOrString::String(string) => {
atom_tbl.build_with(&string)
}
}
}
#[inline]
pub fn as_str(&self) -> &str {
match self {