Skip to main content

Options

Struct Options 

Source
pub struct Options {
    pub sources: Vec<Source>,
    pub formats: Vec<FormatSpec>,
    pub recursive: bool,
    pub flat: bool,
    pub dot_key: bool,
    pub case_sensitive: bool,
    pub order: Order,
    pub tree: bool,
    pub auto_files: bool,
    pub ignore_unknown_ext: bool,
}
Expand description

All loader options.

Plain data on purpose: set the fields you care about and take the rest from ..Options::default().

Fields§

§sources: Vec<Source>

The ordered config sources; later sources override earlier ones. Default: the config folder under the current working directory.

§formats: Vec<FormatSpec>

Which formats to read and which extensions each one claims. The list carries no override-order semantics — it only builds the extension→format mapping (if several entries claim the same extension, the last entry wins the claim). Override order between files is decided by filename alone; see the merge rules in README.md.

§recursive: bool

Scan subdirectories. Default false.

§flat: bool

When recursive, ignore subfolder paths instead of turning them into nested keys. Default true — merge mode flattens; nesting by folder structure is tree mode’s job (or set flat: false).

§dot_key: bool

Treat dotted env/table keys as nested paths: a.b.c becomes { "a": { "b": { "c": … } } }. Default true.

§case_sensitive: bool

Case-sensitive key merging. Default true; when false, keys are normalized to lowercase. (File-extension matching is always case-insensitive and unrelated to this option.)

§order: Order

Load order inside a folder — in merge mode and in tree mode (where it decides key collisions like a.yml vs a folder a/).

§tree: bool

Tree mode (requires the tree feature): instead of merging a folder’s files into one value, every subfolder becomes a key and every file becomes a key named after the file (extension stripped), holding that file’s parsed content. a/b.json = {c:1} and d.json = {a:123} load as {a: {b: {c: 1}}, d: {a: 123}}. recursive, flat and order only apply when this is false. Default false.

§auto_files: bool

Tree mode: parse files without an extension by running the table auto detection over the (trimmed) file content — the same feature-gated guesses, so a/blabla containing 1.1.1.1 becomes an IPv4 value when the ipv4 feature is on, a string otherwise. When false, extension-less files fall under ignore_unknown_ext. (Named auto_files to keep it apart from the table auto format id it reuses.) Default true.

§ignore_unknown_ext: bool

Tree mode: skip files whose extension no active format claims (true), or error on them (false). Default true. (In merge mode unclaimed files are always skipped.)

Trait Implementations§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Options

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Options

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Options

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Options

Source§

fn eq(&self, other: &Options) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Options

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.