Skip to main content

TemplateLoader

Struct TemplateLoader 

Source
pub struct TemplateLoader { /* private fields */ }
Expand description

Template loader that checks external files first, then falls back to embedded.

Load order (highest priority first):

  1. Project-local .aida/templates/
  2. Organization ~/.config/aida/org-templates/
  3. User config ~/.config/aida/templates/
  4. Embedded templates (compiled into binary)

Implementations§

Source§

impl TemplateLoader

Source

pub fn new() -> Self

Create a new template loader

Source

pub fn with_project_root(project_root: &Path) -> Self

Create a template loader with a project root for local templates

Source

pub fn load(&mut self, key: &str) -> Option<String>

Load a template by key (e.g., “skills/aida-req.md”)

Source

pub fn has_template(&self, key: &str) -> bool

Check if a template is available (either external or embedded)

Source

pub fn list_templates(&self) -> Vec<String>

Get all available template keys

Source

pub fn extract_to(&self, dest: &Path) -> Result<Vec<PathBuf>>

Extract all embedded templates to a directory

Source

pub fn get_source(&self, key: &str) -> TemplateSource

Get the source of a template (for debugging/info)

Trait Implementations§

Source§

impl Default for TemplateLoader

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.