pub enum Node {
Identifier(Span),
Void(Span),
Bool(Span, bool),
Int(Span, i64),
Float(Span, f64),
String(Span),
Tree(Span, Vec<Node>),
}Expand description
Describes a node in the AST.
Variants§
Identifier(Span)
A node containing the start and end points of the identifier.
Void(Span)
A node containing the void literal.
Bool(Span, bool)
A node containing a boolean literal.
Int(Span, i64)
A node containing an int literal.
Float(Span, f64)
A node containing a float literal.
String(Span)
A node containing a string literal.
Tree(Span, Vec<Node>)
A node containing a sub-tree.
Implementations§
Source§impl Node
impl Node
Sourcepub fn to_string_literal(&self, src: &str) -> Option<CompactString>
pub fn to_string_literal(&self, src: &str) -> Option<CompactString>
Returns the string literal contained in the node or None if self is not a
Node::String.
pub fn span(&self) -> Span
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
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