[][src]Struct bracket::parser::ast::Block

pub struct Block<'source> { /* fields omitted */ }

Block encapsulates an inner template.

These nodes are rendered indirectly via registered helpers that should call back in to the renderer.

When a block has the raw flag set it should only contain a single Text child node.

Implementations

impl<'source> Block<'source>[src]

pub fn new(source: &'source str, open: Range<usize>, raw: bool) -> Self[src]

Create a new block.

pub fn call(&self) -> &Call<'source>[src]

Get the call for the block.

pub fn set_call(&mut self, call: Call<'source>)[src]

Set the call for the block.

pub fn name(&self) -> Option<&'source str>[src]

The name of this block extracted from the call target.

This will only be available if the call target is a path and the path is a simple identifier.

pub fn is_raw(&self) -> bool[src]

Determine if this block has the raw flag.

pub fn add_condition(&mut self, condition: Block<'source>)[src]

Add a condition to this block.

pub fn conditions(&self) -> &Vec<Node<'source>>[src]

Get the list of conditional blocks.

pub fn push(&mut self, node: Node<'source>)[src]

Add a node to this block; if this block has conditionals then the node is added to the last conditional.

pub fn nodes(&self) -> &'source Vec<Node<'_>>[src]

The collection of nodes for this block.

For raw blocks this should always be a single Text node.

pub fn trim_close(&self) -> TrimHint[src]

The trim hint for the close tag.

Trait Implementations

impl<'_> Debug for Block<'_>[src]

impl<'_> Display for Block<'_>[src]

impl<'source> Element<'source> for Block<'source>[src]

impl<'source> Eq for Block<'source>[src]

impl<'source> PartialEq<Block<'source>> for Block<'source>[src]

impl<'source> Slice<'source> for Block<'source>[src]

impl<'source> StructuralEq for Block<'source>[src]

impl<'source> StructuralPartialEq for Block<'source>[src]

Auto Trait Implementations

impl<'source> RefUnwindSafe for Block<'source>

impl<'source> Send for Block<'source>

impl<'source> Sync for Block<'source>

impl<'source> Unpin for Block<'source>

impl<'source> UnwindSafe for Block<'source>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.