pub struct GeneratorStore { /* private fields */ }Expand description
Storage for generator templates
Templates are loaded from two sources with priority:
- Project templates (highest priority)
- Global templates (lowest priority)
When searching by ID/name, project templates shadow global templates.
Implementations§
Source§impl GeneratorStore
impl GeneratorStore
Sourcepub const GLOBAL_GENERATORS_DIR: &'static str = "generators"
pub const GLOBAL_GENERATORS_DIR: &'static str = "generators"
Global generators directory relative to ~/.ryo/
Sourcepub const PROJECT_GENERATORS_DIR: &'static str = ".ryo/generators"
pub const PROJECT_GENERATORS_DIR: &'static str = ".ryo/generators"
Project generators directory relative to project root
Sourcepub fn load(project_path: &Path) -> Result<Self, GeneratorStoreError>
pub fn load(project_path: &Path) -> Result<Self, GeneratorStoreError>
Sourcepub fn global_only() -> Result<Self, GeneratorStoreError>
pub fn global_only() -> Result<Self, GeneratorStoreError>
Load only global generators
Sourcepub fn find_by_id(&self, id: &str) -> Option<&GeneratorEntry>
pub fn find_by_id(&self, id: &str) -> Option<&GeneratorEntry>
Find a generator by ID (project shadows global)
Sourcepub fn find_by_name(&self, name: &str) -> Option<&GeneratorEntry>
pub fn find_by_name(&self, name: &str) -> Option<&GeneratorEntry>
Find a generator by name (project shadows global)
Sourcepub fn all_generators(&self) -> impl Iterator<Item = &GeneratorEntry>
pub fn all_generators(&self) -> impl Iterator<Item = &GeneratorEntry>
Get all generators (project entries shadow global with same ID)
Sourcepub fn list_names(&self) -> Vec<(&str, GeneratorScope)>
pub fn list_names(&self) -> Vec<(&str, GeneratorScope)>
List all generator names with their scope
Trait Implementations§
Source§impl Debug for GeneratorStore
impl Debug for GeneratorStore
Source§impl Default for GeneratorStore
impl Default for GeneratorStore
Source§fn default() -> GeneratorStore
fn default() -> GeneratorStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for GeneratorStore
impl RefUnwindSafe for GeneratorStore
impl Send for GeneratorStore
impl Sync for GeneratorStore
impl Unpin for GeneratorStore
impl UnsafeUnpin for GeneratorStore
impl UnwindSafe for GeneratorStore
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