Skip to main content

AtNode

Enum AtNode 

Source
pub enum AtNode {
    If(IfNode),
    For(ForNode),
    Match(MatchNode),
    Element(ElementNode),
}
Expand description

An @-prefixed statement in a zyn template.

See the at module for the syntax of each variant.

Variants§

§

If(IfNode)

@if (cond) { ... } @else if (...) { ... } @else { ... }

§

For(ForNode)

@for (item in expr) { ... } or @for (count) { ... }

§

Match(MatchNode)

@match (expr) { pattern => { ... }, ... }

§

Element(ElementNode)

@component_name(prop = val, ...) { children }

Implementations§

Source§

impl AtNode

Source

pub fn is_if(&self) -> bool

Returns true if this is an AtNode::If variant.

Source

pub fn is_for(&self) -> bool

Returns true if this is an AtNode::For variant.

Source

pub fn is_match(&self) -> bool

Returns true if this is an AtNode::Match variant.

Source

pub fn is_element(&self) -> bool

Returns true if this is an AtNode::Element variant.

Source§

impl AtNode

Source

pub fn as_if(&self) -> &IfNode

Returns the inner IfNode. Panics if not an If variant.

Source

pub fn as_for(&self) -> &ForNode

Returns the inner ForNode. Panics if not a For variant.

Source

pub fn as_match(&self) -> &MatchNode

Returns the inner MatchNode. Panics if not a Match variant.

Source

pub fn as_element(&self) -> &ElementNode

Returns the inner ElementNode. Panics if not an Element variant.

Source§

impl AtNode

Source

pub fn span(&self) -> Span

Returns the source span of this node.

Trait Implementations§

Source§

impl Expand for AtNode

Source§

fn expand(&self, output: &Ident, idents: &mut Iter) -> TokenStream

Source§

impl From<AtNode> for Node

Source§

fn from(v: AtNode) -> Self

Converts to this type from the input type.
Source§

impl From<ElementNode> for AtNode

Source§

fn from(v: ElementNode) -> Self

Converts to this type from the input type.
Source§

impl From<ForNode> for AtNode

Source§

fn from(v: ForNode) -> Self

Converts to this type from the input type.
Source§

impl From<IfNode> for AtNode

Source§

fn from(v: IfNode) -> Self

Converts to this type from the input type.
Source§

impl From<MatchNode> for AtNode

Source§

fn from(v: MatchNode) -> Self

Converts to this type from the input type.
Source§

impl Parse for AtNode

Source§

fn parse(input: ParseStream<'_>) -> Result<Self>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.