[−][src]Struct liboverdrop::FragmentScanner
Methods
impl FragmentScanner
[src]
pub fn new(
base_dirs: Vec<String>,
shared_path: &str,
ignore_dotfiles: bool,
allowed_extensions: Vec<String>
) -> Self
[src]
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.
Example
let base_dirs = vec![ String::from("/usr/lib"), String::from("/run"), String::from("/etc"), ]; let allowed_extensions = vec![ String::from("toml"), ]; use liboverdrop::FragmentScanner; let od_cfg = FragmentScanner::new(base_dirs, "my-crate/config.d", false, allowed_extensions);
pub fn scan(&self) -> BTreeMap<String, PathBuf>
[src]
Scan unique configuration fragments from the set configuration directories. Returns a
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.
Example
let base_dirs = vec![ "/usr/lib".to_string(), "/run".to_string(), "/etc".to_string(), ]; let allowed_extensions = vec![ String::from("toml"), ]; use liboverdrop::FragmentScanner; let od_cfg = FragmentScanner::new(base_dirs, "my-crate/config.d", false, allowed_extensions); let fragments = od_cfg.scan();
Auto Trait Implementations
impl Send for FragmentScanner
impl Sync for FragmentScanner
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,