pub struct TemplateFile {
pub name: String,
pub name_with_ext: String,
pub absolute_path: PathBuf,
pub source_dir: PathBuf,
}Expand description
A template file discovered during directory walking.
This struct captures the essential information about a template file without reading its content, enabling lazy loading and hot reloading.
§Fields
name: The resolution name without extension (e.g.,"todos/list")name_with_ext: The resolution name with extension (e.g.,"todos/list.jinja")absolute_path: Full filesystem path for reading contentsource_dir: The template directory this file came from (for collision reporting)
§Example
For a file at /app/templates/todos/list.jinja with root /app/templates:
ⓘ
TemplateFile {
name: "todos/list".to_string(),
name_with_ext: "todos/list.jinja".to_string(),
absolute_path: PathBuf::from("/app/templates/todos/list.jinja"),
source_dir: PathBuf::from("/app/templates"),
}Fields§
§name: StringResolution name without extension (e.g., “config” or “todos/list”)
name_with_ext: StringResolution name with extension (e.g., “config.jinja” or “todos/list.jinja”)
absolute_path: PathBufAbsolute path to the template file
source_dir: PathBufThe template directory root this file belongs to
Implementations§
Source§impl TemplateFile
impl TemplateFile
Sourcepub fn new(
name: impl Into<String>,
name_with_ext: impl Into<String>,
absolute_path: impl Into<PathBuf>,
source_dir: impl Into<PathBuf>,
) -> Self
pub fn new( name: impl Into<String>, name_with_ext: impl Into<String>, absolute_path: impl Into<PathBuf>, source_dir: impl Into<PathBuf>, ) -> Self
Creates a new template file descriptor.
Sourcepub fn extension_priority(&self) -> usize
pub fn extension_priority(&self) -> usize
Returns the extension priority (lower is higher priority).
Returns usize::MAX if the extension is not recognized.
Trait Implementations§
Source§impl Clone for TemplateFile
impl Clone for TemplateFile
Source§fn clone(&self) -> TemplateFile
fn clone(&self) -> TemplateFile
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TemplateFile
impl Debug for TemplateFile
Source§impl From<LoadedFile> for TemplateFile
impl From<LoadedFile> for TemplateFile
Source§fn from(file: LoadedFile) -> Self
fn from(file: LoadedFile) -> Self
Converts to this type from the input type.
Source§impl From<TemplateFile> for LoadedFile
impl From<TemplateFile> for LoadedFile
Source§fn from(file: TemplateFile) -> Self
fn from(file: TemplateFile) -> Self
Converts to this type from the input type.
Source§impl PartialEq for TemplateFile
impl PartialEq for TemplateFile
impl Eq for TemplateFile
impl StructuralPartialEq for TemplateFile
Auto Trait Implementations§
impl Freeze for TemplateFile
impl RefUnwindSafe for TemplateFile
impl Send for TemplateFile
impl Sync for TemplateFile
impl Unpin for TemplateFile
impl UnwindSafe for TemplateFile
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.