pub enum Node {
Const(ConstKind),
Num {
val: BigRational,
input_base: Option<u32>,
},
Inverse(Box<Node>),
VarOp {
kind: VarOpKind,
children: Vec<Node>,
},
Exp(Box<Node>, Box<Node>),
}
Expand description
A node is an operation in the AST (abstract syntax tree).
Variants
Const(ConstKind)
Num
Fields
val: BigRational
The number the node represents
Inverse(Box<Node>)
VarOp
Exp(Box<Node>, Box<Node>)
Implementations
sourceimpl Node
impl Node
sourcepub fn eval(self) -> EvalResult
pub fn eval(self) -> EvalResult
Approximates the node value.
pub fn deep_reduce(self) -> Node
pub fn one() -> Node
pub fn minus_one() -> Node
pub fn add(a: Node, b: Node) -> Node
pub fn sub(a: Node, b: Node) -> Node
pub fn mul(a: Node, b: Node) -> Node
pub fn div(a: Node, b: Node) -> Node
pub fn opposite(inner: Node) -> Node
Trait Implementations
impl Eq for Node
impl StructuralEq for Node
impl StructuralPartialEq for Node
Auto Trait Implementations
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more