pub enum TermTree {
Leaf(String),
Node {
symbol: String,
children: Vec<TermTree>,
},
}Expand description
A concrete tree-structured term.
Variants§
Leaf(String)
A leaf node (constant or variable). Variables are uppercase by convention.
Node
A node with a symbol and children (function application).
Implementations§
Source§impl TermTree
impl TermTree
Sourcepub fn node(symbol: impl Into<String>, children: Vec<TermTree>) -> Self
pub fn node(symbol: impl Into<String>, children: Vec<TermTree>) -> Self
Convenience constructor for a node.
Sourcepub fn is_variable(&self) -> bool
pub fn is_variable(&self) -> bool
Returns true if this term is a variable (leaf with uppercase first char).
Sourcepub fn root_symbol(&self) -> Option<&str>
pub fn root_symbol(&self) -> Option<&str>
Returns the root symbol, if any.
Trait Implementations§
impl Eq for TermTree
impl StructuralPartialEq for TermTree
Auto Trait Implementations§
impl Freeze for TermTree
impl RefUnwindSafe for TermTree
impl Send for TermTree
impl Sync for TermTree
impl Unpin for TermTree
impl UnsafeUnpin for TermTree
impl UnwindSafe for TermTree
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