Struct liquid_core::TagBlock[][src]

pub struct TagBlock<'a: 'b, 'b> { /* fields omitted */ }

An interface to access elements inside a block.

Implementations

impl<'a, 'b> TagBlock<'a, 'b>[src]

pub fn next(&mut self) -> Result<Option<BlockElement<'a>>>[src]

Returns the next element of the block, if any, similarly to an iterator.

However, if the input text reaches its end and the block is not closed, an error is returned instead.

pub fn escape_liquid(&mut self, allow_nesting: bool) -> Result<&'a str>[src]

Retrieves all the content of this block as a String, regardless of being valid liquid or not.

Do not use this method in a block you already called .next() on.

Set the parameter allow_nesting of this function to true if you still want these tags to nest (so the number of {% name %} must be equal to the number of {% endname %}) of false if you don’t (only the first {% name %} is parsed, a single {% endname %} will always close the tag).

Panics

Will panic if used in a closed block.

pub fn parse_all(
    &mut self,
    options: &Language
) -> Result<Vec<Box<dyn Renderable>>>
[src]

A convenient method that parses every element remaining in the block.

pub fn parse_next(
    &mut self,
    options: &Language
) -> Result<Option<Box<dyn Renderable>>>
[src]

Parses the next element in the block just as if it weren’t inside any block.

Returns none if no element is left and raises the same errors as next().

pub fn assert_empty(self)[src]

Checks whether the block was fully parsed its elements.

This must be added at the end of every block right before returning, so as to ensure that it doesn’t leave any unparsed element by accident.

Auto Trait Implementations

impl<'a, 'b> !RefUnwindSafe for TagBlock<'a, 'b>

impl<'a, 'b> !Send for TagBlock<'a, 'b>

impl<'a, 'b> !Sync for TagBlock<'a, 'b>

impl<'a, 'b> Unpin for TagBlock<'a, 'b> where
    'a: 'b, 

impl<'a, 'b> !UnwindSafe for TagBlock<'a, 'b>

Blanket Implementations

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

impl<T> Any for T where
    T: Any
[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, 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.