Struct rubble_templates_evaluators::simple::template::EvaluableMixedContentIterator[][src]

pub struct EvaluableMixedContentIterator<'a, T> {
    pub source: &'a T,
    pub current_position: usize,
}

Iterates over some template source and returns code fragments that needs evaluation.

It can be used to return all evaluation spots from a template. For example, there is an implementation that looks for all embedded code fragments and returns them as [TemplateSlice]s for further evaluation.

Fields

source: &'a Tcurrent_position: usize

Trait Implementations

impl<'a> Iterator for EvaluableMixedContentIterator<'a, Template>[src]

Used to iterate over a template and extract all code blocks.

use rubble_templates_core::template::{EvaluableMixedContent, TemplateSlice};
use rubble_templates_evaluators::simple::template::Template;

let template = Template::from("Some template {{ variable }}".to_string());
let all_evaluation_spots: Vec<TemplateSlice> = template.into_iter().collect();
let expected = vec![
            TemplateSlice::Text {
                value: "Some template ",
                start_position: 0,
                end_position: 14,
            },
            TemplateSlice::Code {
                value: "{{ variable }}",
                start_position: 14,
                end_position: 28,
            },
        ];

assert_eq!(all_evaluation_spots, expected);

type Item = TemplateSlice<'a>

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for EvaluableMixedContentIterator<'a, T> where
    T: RefUnwindSafe

impl<'a, T> Send for EvaluableMixedContentIterator<'a, T> where
    T: Sync

impl<'a, T> Sync for EvaluableMixedContentIterator<'a, T> where
    T: Sync

impl<'a, T> Unpin for EvaluableMixedContentIterator<'a, T>

impl<'a, T> UnwindSafe for EvaluableMixedContentIterator<'a, T> where
    T: RefUnwindSafe

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<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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.