[][src]Struct bracket::template::Loader

pub struct Loader { /* fields omitted */ }

Storage for template sources.

Implementations

impl Loader[src]

pub fn new() -> Self[src]

Create an empty loader.

pub fn sources(&self) -> &HashMap<String, String>[src]

Get the map of template source content.

pub fn insert<N, S>(&mut self, name: N, content: S) where
    N: AsRef<str>,
    S: AsRef<str>, 
[src]

Insert a named string template.

pub fn add<N, P>(&mut self, name: N, file: P) -> Result<()> where
    N: AsRef<str>,
    P: AsRef<Path>, 
[src]

Add a named template from a file.

Requires the fs feature.

pub fn load<P: AsRef<Path>>(&mut self, file: P) -> Result<()>[src]

Load a file and use the file path as the template name.

Requires the fs feature.

pub fn read_dir<P: AsRef<Path>>(
    &mut self,
    file: P,
    extension: &str
) -> Result<()>
[src]

Load all the files in a target directory that match the given extension.

The generated name is the file stem; ie, the name of the file once the extension has been removed.

Requires the fs feature.

Trait Implementations

impl Default for Loader[src]

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 RefUnwindSafe for Loader

impl Send for Loader

impl Sync for Loader

impl Unpin for Loader

impl UnwindSafe for Loader

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.