Trait moonlander_gp::AstNode
[−]
[src]
pub trait AstNode: Any + Mutatable + Copyable + Sync { fn node_type(&self) -> usize; fn children(&self) -> Vec<&AstNode>; fn replace_child(
&self,
old_child: &AstNode,
new_child: &mut Option<Box<AstNode>>
) -> Box<AstNode>; }
Main trait to be implemented for AST node types
Required Methods
fn node_type(&self) -> usize
Identify the node type, because Any::get_type_id() is unstable.
fn children(&self) -> Vec<&AstNode>
Return all children of this node.
fn replace_child(
&self,
old_child: &AstNode,
new_child: &mut Option<Box<AstNode>>
) -> Box<AstNode>
&self,
old_child: &AstNode,
new_child: &mut Option<Box<AstNode>>
) -> Box<AstNode>
Return a copy of this node with a single child node replaced.
Methods
impl AstNode
fn is<T>(&self) -> bool where
T: Any,
Self: Downcast<T>,
T: Any,
Self: Downcast<T>,
unsafe fn downcast_ref_unchecked<T>(&self) -> &T where
T: Any,
Self: Downcast<T>,
T: Any,
Self: Downcast<T>,
fn downcast_ref<T>(&self) -> Option<&T> where
T: Any,
Self: Downcast<T>,
T: Any,
Self: Downcast<T>,
unsafe fn downcast_mut_unchecked<T>(&mut self) -> &mut T where
T: Any,
Self: Downcast<T>,
T: Any,
Self: Downcast<T>,
fn downcast_mut<T>(&mut self) -> Option<&mut T> where
T: Any,
Self: Downcast<T>,
T: Any,
Self: Downcast<T>,
unsafe fn unchecked_downcast<T>(self: Box<Self>) -> Box<T> where
T: Any,
Self: Downcast<T>,
T: Any,
Self: Downcast<T>,
fn downcast<T>(self: Box<Self>) -> Result<Box<T>, Box<Self>> where
T: Any,
Self: Downcast<T>,
T: Any,
Self: Downcast<T>,
Trait Implementations
impl<T> Downcast<T> for AstNode where
T: AstNode,
T: AstNode,