[][src]Struct bracket::template::Templates

pub struct Templates<'source> { /* fields omitted */ }

Collection of named templates.

For partials to be resolved they must exist in a collection that is used during a render.

Implementations

impl<'source> Templates<'source>[src]

pub fn new() -> Self[src]

Create an empty templates collection.

pub fn insert(&mut self, name: &'source str, template: Template<'source>)[src]

Add a named template.

If a template already exists with the given name it is overwritten.

pub fn remove(&mut self, name: &'source str) -> Option<Template<'source>>[src]

Remove a named template.

pub fn get(&self, name: &str) -> Option<&Template<'source>>[src]

Get a named template from this collection.

pub fn compile(s: &str, options: ParserOptions) -> Result<Template<'_>>[src]

Compile a string to a template.

Trait Implementations

impl<'source> Default for Templates<'source>[src]

impl<'reg, 'source> From<Templates<'source>> for Registry<'reg, 'source>[src]

Create a registry using a collection of templates.

impl<'source> TryFrom<&'source Loader> for Templates<'source>[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<'source> RefUnwindSafe for Templates<'source>

impl<'source> Send for Templates<'source>

impl<'source> Sync for Templates<'source>

impl<'source> Unpin for Templates<'source>

impl<'source> UnwindSafe for Templates<'source>

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<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.