avoid writing chars to the atom table in several places
This commit is contained in:
12
src/forms.rs
12
src/forms.rs
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user