Skip to main content

Builder

Struct Builder 

Source
pub struct Builder(/* private fields */);
Expand description

Represents a configuration builder.

Implementations§

Source§

impl Builder

Source

pub fn providers(&self) -> impl Iterator<Item = &dyn Provider>

Source

pub fn add(&mut self, provider: impl Provider + 'static)

Adds a new configuration provider.

§Arguments
Source

pub fn build(&self) -> Result<Configuration>

Builds a configuration from the registered configuration providers.

Trait Implementations§

Source§

impl ChainedExt for Builder

Available on crate feature chained only.
Source§

fn add_configuration<T: Into<Arc<Configuration>>>( self, configuration: T, ) -> Self

Adds an existing configuration. Read more
Source§

impl CommandLineExt for Builder

Available on crate feature cmd only.
Source§

fn add_command_line(self) -> Self

Adds a command line configuration source.
Source§

fn add_command_line_map<S: AsRef<str>>(self, switch_mappings: &[(S, S)]) -> Self

Adds a command line configuration source. Read more
Source§

impl Default for Builder

Source§

fn default() -> Builder

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

impl EnvVarsExt for Builder

Available on crate feature env only.
Source§

fn add_env_vars_with_prefix<S: Into<String>>(self, prefix: S) -> Self

Adds environment variables as a configuration source. Read more
Source§

fn add_env_vars(self) -> Self

Adds environment variables as a configuration source.
Source§

impl IniExt for Builder

Available on crate feature ini only.
Source§

fn add_ini_file<F: Into<FileSource>>(self, file: F) -> Self

Adds an *.ini file as a configuration source. Read more
Source§

impl JsonExt for Builder

Available on crate feature json only.
Source§

fn add_json_file<F: Into<FileSource>>(self, file: F) -> Self

Adds a *.json file as a configuration source. Read more
Source§

impl MemoryExt for Builder

Available on crate feature mem only.
Source§

fn add_in_memory<S: AsRef<str>>(self, data: &[(S, S)]) -> Self

Adds an in-memory configuration source using the specified data. Read more
Source§

impl TryFrom<Builder> for Configuration

Source§

type Error = Error

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

fn try_from(builder: Builder) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<Builder> for ReloadableConfiguration

Source§

type Error = Error

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

fn try_from(builder: Builder) -> Result<Self>

Performs the conversion.
Source§

impl TypedExt for Builder

Available on crate feature typed only.
Source§

fn add_typed<T: Serialize + Send + Sync + 'static>(self, value: T) -> Self

Adds a typed configuration source using a serializable type. Read more
Source§

impl XmlExt for Builder

Available on crate feature xml only.
Source§

fn add_xml_file<F: Into<FileSource>>(self, file: F) -> Self

Adds a *.xml file as a configuration source. Read more
Source§

impl YamlExt for Builder

Available on crate feature yaml only.
Source§

fn add_yaml_file<F: Into<FileSource>>(self, file: F) -> Self

Adds a *.yaml file as a configuration source. Read more

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more