pub struct DirSet {
pub dirs: Vec<Dir>,
}
Expand description
Represents a set of root directories, supporting overlay and override semantics. Later directories in the set can override files from earlier ones with the same relative path.
Fields§
§dirs: Vec<Dir>
The list of root directories, in order of increasing precedence.
Implementations§
Source§impl DirSet
impl DirSet
Sourcepub fn new(dirs: Vec<Dir>) -> Self
pub fn new(dirs: Vec<Dir>) -> Self
Creates a new DirSet from the given list of directories. The order of directories determines override precedence.
Sourcepub fn get_file(&self, name: &str) -> Option<File>
pub fn get_file(&self, name: &str) -> Option<File>
Returns the file with the given name, searching roots in reverse order. Files in later roots override those in earlier roots if the relative path matches.
pub fn get_dir(&self, name: &str) -> Option<Dir>
Sourcepub fn walk(&self) -> impl Iterator<Item = File>
pub fn walk(&self) -> impl Iterator<Item = File>
Recursively walks all files in all root directories. Files with the same relative path from different roots are all included.
Sourcepub fn walk_override(&self) -> impl Iterator<Item = File>
pub fn walk_override(&self) -> impl Iterator<Item = File>
Recursively walks all files, yielding only the highest-precedence file for each relative path. This implements the override behaviour: later roots take precedence over earlier ones.