pub struct Locator { /* private fields */ }Implementations§
Source§impl Locator
impl Locator
Sourcepub fn from_patterns(patterns: &[&str]) -> Result<Self, RenderError>
pub fn from_patterns(patterns: &[&str]) -> Result<Self, RenderError>
Create a Locator by scanning files matching glob patterns.
Each pattern is a glob like "./components/**/*.html".
The element name for each file is its stem (e.g. my-button from my-button.html).
Errors if two different files resolve to the same element name.
Sourcepub fn from_templates(templates: HashMap<String, String>) -> Self
pub fn from_templates(templates: HashMap<String, String>) -> Self
Create a Locator from an explicit map (useful for testing without filesystem).
Sourcepub fn add_template(&mut self, element_name: &str, content: &str)
pub fn add_template(&mut self, element_name: &str, content: &str)
Add a template directly.
pub fn get_template(&self, element_name: &str) -> Option<&str>
pub fn has_template(&self, element_name: &str) -> bool
Auto Trait Implementations§
impl Freeze for Locator
impl RefUnwindSafe for Locator
impl Send for Locator
impl Sync for Locator
impl Unpin for Locator
impl UnsafeUnpin for Locator
impl UnwindSafe for Locator
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