Struct liboverdrop::FragmentScanner
source · pub struct FragmentScanner { /* private fields */ }
Expand description
Configuration fragments scanner.
Implementations§
source§impl FragmentScanner
impl FragmentScanner
sourcepub fn new(
base_dirs: Vec<String>,
shared_path: &str,
ignore_dotfiles: bool,
allowed_extensions: Vec<String>
) -> Self
pub fn new(
base_dirs: Vec<String>,
shared_path: &str,
ignore_dotfiles: bool,
allowed_extensions: Vec<String>
) -> Self
Returns a new FragmentScanner, initialized with a vector of directory paths to scan for configuration fragments.
Arguments
base_dirs
- Vector holding base components of directories where configuration fragments are located.shared_path
- Common relative path from each entry inbase_dirs
to the directory holding configuration fragments.ignore_dotfiles
- Whether to ignore dotfiles (hidden files with name prefixed with ‘.’).allowed_extensions
- Only scan files that have an extension listed inallowed_extensions
. If an empty vector is passed, then any extensions are allowed.
shared_path
is concatenated to each entry in base_dirs
to form the directory paths to
scan.
sourcepub fn scan(&self) -> BTreeMap<String, PathBuf>
pub fn scan(&self) -> BTreeMap<String, PathBuf>
Scan unique configuration fragments from the set configuration directories. Returns a
std::collections::BTreeMap
indexed by configuration fragment filename, holding the path where
the unique configuration fragment is located.
Configuration fragments are stored in the BTreeMap
in alphanumeric order by filename.
Configuration fragments existing in directories that are scanned later override fragments
of the same filename in directories that are scanned earlier.