Compiler

Trait Compiler 

Source
pub trait Compiler<T> {
    type Item;
    type ItemIterator: Iterator<Item = Self::Item>;

    // Required method
    fn compile<C>(
        &self,
        content: C,
        context: Context,
    ) -> Result<String, CompilationError>
       where C: EvaluableMixedContent<Item = Self::Item, IntoIter = Self::ItemIterator>;
}
Expand description

Describes a struct that is able to compile a template.

Any implementation of this trait should be able to compile a template from specified input Iterator and Items. For example, you may specify a custom iterator and custom items that are supported by your Compiler.

The compiler should return the resulting String compiled from all items that the iterator returned.

Required Associated Types§

Source

type Item

Type of a single template part that can be compiled/evaluated/parsed.

Those parts will be compiled into a template

Source

type ItemIterator: Iterator<Item = Self::Item>

Iterator that can provide template parts that need to be compiled.

Required Methods§

Source

fn compile<C>( &self, content: C, context: Context, ) -> Result<String, CompilationError>
where C: EvaluableMixedContent<Item = Self::Item, IntoIter = Self::ItemIterator>,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§