pub struct FragmentScanner { /* private fields */ }
Expand description

Configuration fragments scanner.

Implementations§

source§

impl FragmentScanner

source

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 in base_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 in allowed_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.

source

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.

Trait Implementations§

source§

impl Debug for FragmentScanner

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.