pub struct TemplateRepository { /* private fields */ }Expand description
Template repository manager
Implementations§
Source§impl TemplateRepository
impl TemplateRepository
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a new template repository manager
§Errors
Returns an error if the cache directory cannot be created or accessed.
Sourcepub fn list_cached(&self) -> Vec<&CachedTemplate>
pub fn list_cached(&self) -> Vec<&CachedTemplate>
List all cached templates
Sourcepub fn get_cached(&self, name: &str) -> Option<&CachedTemplate>
pub fn get_cached(&self, name: &str) -> Option<&CachedTemplate>
Get a cached template by name
Sourcepub fn add_to_cache(&mut self, template: CachedTemplate) -> Result<()>
pub fn add_to_cache(&mut self, template: CachedTemplate) -> Result<()>
Sourcepub fn remove_from_cache(&mut self, name: &str) -> Result<()>
pub fn remove_from_cache(&mut self, name: &str) -> Result<()>
Remove a template from cache
§Errors
Returns an error if the cached directory or index cannot be updated.
Sourcepub fn cache_directory(&self) -> &Path
pub fn cache_directory(&self) -> &Path
Get cache directory path
Sourcepub fn template_cache_path(&self, name: &str) -> PathBuf
pub fn template_cache_path(&self, name: &str) -> PathBuf
Get the path where a template should be cached
Auto Trait Implementations§
impl Freeze for TemplateRepository
impl RefUnwindSafe for TemplateRepository
impl Send for TemplateRepository
impl Sync for TemplateRepository
impl Unpin for TemplateRepository
impl UnsafeUnpin for TemplateRepository
impl UnwindSafe for TemplateRepository
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more