pub enum AtomNode<'a> {
Num(i64),
Var(Symbol),
Fun(Symbol, &'a [Atom<'a>]),
Add(&'a [Atom<'a>]),
Mul(&'a [Atom<'a>]),
Pow(Atom<'a>, Atom<'a>),
}Expand description
The concrete data stored for each expression node.
§Example
use ocas_atom::{AtomArena, AtomNode};
use ocas_core::arena::Arena;
let arena = Arena::new();
let ctx = AtomArena::new(&arena);
let x = ctx.var("x");
match x.node() {
AtomNode::Var(s) => assert_eq!(s.as_str(), "x"),
_ => panic!("expected variable"),
}Variants§
Num(i64)
A 64-bit signed integer literal.
Var(Symbol)
A named variable or constant.
Fun(Symbol, &'a [Atom<'a>])
A named function applied to a list of arguments.
Add(&'a [Atom<'a>])
A sum of sub-expressions.
Mul(&'a [Atom<'a>])
A product of sub-expressions.
Pow(Atom<'a>, Atom<'a>)
A power with base and exponent.
Trait Implementations§
impl<'a> Copy for AtomNode<'a>
impl<'a> Eq for AtomNode<'a>
Source§impl<'a> Ord for AtomNode<'a>
impl<'a> Ord for AtomNode<'a>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a> PartialEq for AtomNode<'a>
impl<'a> PartialEq for AtomNode<'a>
Source§impl<'a> PartialOrd for AtomNode<'a>
impl<'a> PartialOrd for AtomNode<'a>
impl<'a> StructuralPartialEq for AtomNode<'a>
Auto Trait Implementations§
impl<'a> Freeze for AtomNode<'a>
impl<'a> RefUnwindSafe for AtomNode<'a>
impl<'a> Send for AtomNode<'a>
impl<'a> Sync for AtomNode<'a>
impl<'a> Unpin for AtomNode<'a>
impl<'a> UnsafeUnpin for AtomNode<'a>
impl<'a> UnwindSafe for AtomNode<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more