pub enum Node {
Tokens(TokensNode),
Interp(InterpNode),
At(AtNode),
Group(GroupNode),
}Expand description
A single node in a parsed zyn template.
See the ast module for the full node taxonomy.
Variants§
Tokens(TokensNode)
Literal Rust tokens passed through unchanged.
Interp(InterpNode)
An interpolation expression: {{ expr }} or {{ expr | pipe | ... }}.
At(AtNode)
An @-prefixed control-flow or element statement.
Group(GroupNode)
A delimited group: (...), [...], or {...}.
Implementations§
Source§impl Node
impl Node
Sourcepub fn is_tokens(&self) -> bool
pub fn is_tokens(&self) -> bool
Returns true if this is a Node::Tokens variant.
Sourcepub fn is_interp(&self) -> bool
pub fn is_interp(&self) -> bool
Returns true if this is a Node::Interp variant.
Sourcepub fn is_group(&self) -> bool
pub fn is_group(&self) -> bool
Returns true if this is a Node::Group variant.
Source§impl Node
impl Node
Sourcepub fn as_tokens(&self) -> &TokensNode
pub fn as_tokens(&self) -> &TokensNode
Returns the inner TokensNode. Panics if not a Tokens variant.
Sourcepub fn as_interp(&self) -> &InterpNode
pub fn as_interp(&self) -> &InterpNode
Returns the inner InterpNode. Panics if not an Interp variant.
Source§impl Node
impl Node
pub fn parse_brace(input: ParseStream<'_>) -> Result<Self>
Trait Implementations§
Source§impl From<InterpNode> for Node
impl From<InterpNode> for Node
Source§fn from(v: InterpNode) -> Self
fn from(v: InterpNode) -> Self
Converts to this type from the input type.
Source§impl From<TokensNode> for Node
impl From<TokensNode> for Node
Source§fn from(v: TokensNode) -> Self
fn from(v: TokensNode) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl !Send for Node
impl !Sync for Node
impl Unpin for Node
impl UnsafeUnpin 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