[−][src]Struct bracket::template::Loader
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]
N: AsRef<str>,
S: AsRef<str>,
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]
N: AsRef<str>,
P: AsRef<Path>,
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]
&mut self,
file: P,
extension: &str
) -> Result<()>
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,