[−][src]Struct liquid::compiler::TagToken
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]
self,
options: &Language
) -> TryMatchToken<'a, FilterChain>
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
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: Any,
T: Any,