[][src]Struct liquid::compiler::TagToken

pub struct TagToken<'a> { /* fields omitted */ }

An interface to access tokens inside a tag.

Methods

impl<'a> TagToken<'a>[src]

pub fn raise_error(self) -> Error[src]

Raises an error from this TagToken.

The error message will be based on the expected tokens, which this structure tracks when using the methods starting with 'expect'.

For example, if one calls expect_value and that function fails to give an Ok value, calling this would show Expected Value on the error message.

pub fn raise_custom_error(self, msg: &str) -> Error[src]

Raises an error from this TagToken.

The error will have the given error message.

pub fn expect_filter_chain(
    self,
    options: &Language
) -> TryMatchToken<'a, FilterChain>
[src]

Tries to obtain a FilterChain from this token.

pub fn expect_value(self) -> TryMatchToken<'a, Expression>[src]

Tries to obtain a value from this token.

Do not confuse this value with liquid-value's Value. In this context, value refers to either a literal value or a variable.

pub fn expect_variable(self) -> TryMatchToken<'a, Variable>[src]

Tries to obtain a Variable from this token.

pub fn expect_identifier(self) -> TryMatchToken<'a, &'a str>[src]

Tries to obtain an identifier from this token.

The identifier is returned as a str.

pub fn expect_literal(self) -> TryMatchToken<'a, Value>[src]

Tries to obtain a literal value from this token.

The value is returned as a Value.

pub fn expect_range(self) -> TryMatchToken<'a, (Expression, Expression)>[src]

Tries to obtain a range from this token.

The range is returned as a pair (Expression, Expression).

pub fn expect_str(self, expected: &str) -> TryMatchToken<'a, ()>[src]

Returns Ok if and only if the tokens' str is equal to the given str.

pub fn as_str(&self) -> &str[src]

Returns token as a str.

Trait Implementations

impl<'a> From<Pair<'a, Rule>> for TagToken<'a>[src]

Auto Trait Implementations

impl<'a> !Send for TagToken<'a>

impl<'a> !Sync for TagToken<'a>

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

impl<T> Any for T where
    T: Any