pub struct TemplateLibrary { /* private fields */ }Expand description
Template library registry
Implementations§
Source§impl TemplateLibrary
impl TemplateLibrary
Sourcepub fn register_template(&mut self, metadata: TemplateMetadata) -> Result<()>
pub fn register_template(&mut self, metadata: TemplateMetadata) -> Result<()>
Register a template in the library
Sourcepub fn get_template(&self, id: &str) -> Option<&TemplateLibraryEntry>
pub fn get_template(&self, id: &str) -> Option<&TemplateLibraryEntry>
Get a template by ID
Sourcepub fn get_template_version(&self, id: &str, version: &str) -> Option<String>
pub fn get_template_version(&self, id: &str, version: &str) -> Option<String>
Get a specific version of a template
Sourcepub fn get_latest_template(&self, id: &str) -> Option<String>
pub fn get_latest_template(&self, id: &str) -> Option<String>
Get the latest version of a template
Sourcepub fn list_templates(&self) -> Vec<&TemplateLibraryEntry>
pub fn list_templates(&self) -> Vec<&TemplateLibraryEntry>
List all templates
Sourcepub fn search_templates(&self, query: &str) -> Vec<&TemplateLibraryEntry>
pub fn search_templates(&self, query: &str) -> Vec<&TemplateLibraryEntry>
Search templates by query
Sourcepub fn templates_by_category(
&self,
category: &str,
) -> Vec<&TemplateLibraryEntry>
pub fn templates_by_category( &self, category: &str, ) -> Vec<&TemplateLibraryEntry>
Search templates by category
Sourcepub fn remove_template(&mut self, id: &str) -> Result<()>
pub fn remove_template(&mut self, id: &str) -> Result<()>
Remove a template
Sourcepub fn remove_template_version(&mut self, id: &str, version: &str) -> Result<()>
pub fn remove_template_version(&mut self, id: &str, version: &str) -> Result<()>
Remove a specific version of a template
Sourcepub fn storage_dir(&self) -> &Path
pub fn storage_dir(&self) -> &Path
Get storage directory
Auto Trait Implementations§
impl Freeze for TemplateLibrary
impl RefUnwindSafe for TemplateLibrary
impl Send for TemplateLibrary
impl Sync for TemplateLibrary
impl Unpin for TemplateLibrary
impl UnwindSafe for TemplateLibrary
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