pub struct LoadedFile {
pub name: String,
pub name_with_ext: String,
pub path: PathBuf,
pub source_dir: PathBuf,
}Expand description
A file discovered during directory walking.
This struct captures essential metadata about a 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.tmpl")path: Absolute filesystem path for reading contentsource_dir: The root directory this file came from (for collision reporting)
§Example
For a file at /app/templates/todos/list.tmpl with root /app/templates:
ⓘ
LoadedFile {
name: "todos/list".to_string(),
name_with_ext: "todos/list.tmpl".to_string(),
path: PathBuf::from("/app/templates/todos/list.tmpl"),
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.tmpl” or “todos/list.tmpl”).
path: PathBufAbsolute path to the file.
source_dir: PathBufThe source directory this file belongs to.
Implementations§
Source§impl LoadedFile
impl LoadedFile
Sourcepub fn new(
name: impl Into<String>,
name_with_ext: impl Into<String>,
path: impl Into<PathBuf>,
source_dir: impl Into<PathBuf>,
) -> Self
pub fn new( name: impl Into<String>, name_with_ext: impl Into<String>, path: impl Into<PathBuf>, source_dir: impl Into<PathBuf>, ) -> Self
Creates a new loaded file descriptor.
Sourcepub fn extension_priority(&self, extensions: &[&str]) -> usize
pub fn extension_priority(&self, extensions: &[&str]) -> usize
Returns the extension priority for this file given a list of extensions.
Lower values indicate higher priority. Returns usize::MAX if the file’s
extension is not in the list.
Trait Implementations§
Source§impl Clone for LoadedFile
impl Clone for LoadedFile
Source§fn clone(&self) -> LoadedFile
fn clone(&self) -> LoadedFile
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 LoadedFile
impl Debug for LoadedFile
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 LoadedFile
impl PartialEq for LoadedFile
impl Eq for LoadedFile
impl StructuralPartialEq for LoadedFile
Auto Trait Implementations§
impl Freeze for LoadedFile
impl RefUnwindSafe for LoadedFile
impl Send for LoadedFile
impl Sync for LoadedFile
impl Unpin for LoadedFile
impl UnwindSafe for LoadedFile
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.