use super::{
Atom, AtomOrView, AtomView,
representation::{InlineNum, InlineVar},
};
pub trait AtomCore {
fn as_atom_view(&self) -> AtomView<'_>;
fn to_atom(&self) -> Atom {
self.as_atom_view().to_owned()
}
}
impl AtomCore for Atom {
fn as_atom_view(&self) -> AtomView<'_> {
self.as_view()
}
}
impl<'a> AtomCore for AtomView<'a> {
fn as_atom_view(&self) -> AtomView<'_> {
*self
}
}
impl AtomCore for InlineVar {
fn as_atom_view(&self) -> AtomView<'_> {
self.as_view()
}
}
impl AtomCore for InlineNum {
fn as_atom_view(&self) -> AtomView<'_> {
self.as_view()
}
}
impl<'a> AtomCore for AtomOrView<'a> {
fn as_atom_view(&self) -> AtomView<'_> {
self.as_view()
}
}
impl AtomCore for &Atom {
fn as_atom_view(&self) -> AtomView<'_> {
(*self).as_view()
}
}
impl AtomCore for &mut Atom {
fn as_atom_view(&self) -> AtomView<'_> {
(**self).as_view()
}
}