Skip to main content

Loader

Struct Loader 

Source
pub struct Loader<'a> { /* private fields */ }
Expand description

Collects the inputs of one load.

Implementations§

Source§

impl<'a> Loader<'a>

Source

pub fn new(schema: &'a Schema) -> Self

A loader over schema with no file, environment, arguments or modules yet.

Source

pub fn modules(self, modules: &'a Modules) -> Self

The modules that values with a provider are checked by.

Source

pub fn file(self, name: &str, text: &str) -> Self

A TOML configuration file’s text, and the name to show for it.

Source

pub fn env(self, env: BTreeMap<String, String>) -> Self

Environment variables (the whole environment is fine: only declared names and unknown names under the schema’s env_prefix matter).

Source

pub fn cli(self, args: Vec<String>) -> Self

Command-line arguments, without the program name.

Source

pub fn resolved(self, values: BTreeMap<String, String>) -> Self

Secrets fetched from their sources, by key (the configurant-secrets crate does the fetching). Each key must be a secret value that declares a source; anything else is refused. They are checked and redacted like the same secret from the environment, which overrides them.

Source

pub fn build(&self) -> Result<Config, Errors>

Layer in the standard order (with the source layer below the environment) and validate.

Source

pub fn build_with_order(&self, order: &[Layer]) -> Result<Config, Errors>

Layer in a given order, lowest precedence first. Exists so the precedence test can prove that it fails against an inverted order.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Loader<'a>

§

impl<'a> !Send for Loader<'a>

§

impl<'a> !Sync for Loader<'a>

§

impl<'a> !UnwindSafe for Loader<'a>

§

impl<'a> Forget for Loader<'a>

§

impl<'a> Freeze for Loader<'a>
where &'a Schema: Freeze, &'a Modules: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const LeafNode<String, String> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(String, String)>>: Freeze, PhantomData<String>: Freeze,

§

impl<'a> Move for Loader<'a>

§

impl<'a> Unpin for Loader<'a>
where &'a Schema: Unpin, &'a Modules: Unpin, *const u8 is !null: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin,

§

impl<'a> UnsafeUnpin for Loader<'a>

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.