pub struct TemplateLoader { /* private fields */ }Expand description
Template loader that checks external files first, then falls back to embedded.
Load order (highest priority first):
- Project-local
.aida/templates/ - Organization
~/.config/aida/org-templates/ - User config
~/.config/aida/templates/ - Embedded templates (compiled into binary)
Implementations§
Source§impl TemplateLoader
impl TemplateLoader
Sourcepub fn with_project_root(project_root: &Path) -> Self
pub fn with_project_root(project_root: &Path) -> Self
Create a template loader with a project root for local templates
Sourcepub fn load(&mut self, key: &str) -> Option<String>
pub fn load(&mut self, key: &str) -> Option<String>
Load a template by key (e.g., “skills/aida-req.md”)
Sourcepub fn has_template(&self, key: &str) -> bool
pub fn has_template(&self, key: &str) -> bool
Check if a template is available (either external or embedded)
Sourcepub fn list_templates(&self) -> Vec<String>
pub fn list_templates(&self) -> Vec<String>
Get all available template keys
Sourcepub fn extract_to(&self, dest: &Path) -> Result<Vec<PathBuf>>
pub fn extract_to(&self, dest: &Path) -> Result<Vec<PathBuf>>
Extract all embedded templates to a directory
Sourcepub fn get_source(&self, key: &str) -> TemplateSource
pub fn get_source(&self, key: &str) -> TemplateSource
Get the source of a template (for debugging/info)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TemplateLoader
impl RefUnwindSafe for TemplateLoader
impl Send for TemplateLoader
impl Sync for TemplateLoader
impl Unpin for TemplateLoader
impl UnsafeUnpin for TemplateLoader
impl UnwindSafe for TemplateLoader
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