[−][src]Struct spirit::cfg_loader::Builder
A builder for the Loader
.
See the module documentation for details about the use.
Implementations
impl Builder
[src]
pub fn new() -> Self
[src]
Creates a new config loader builder.
pub fn build<O: StructOpt>(self) -> (O, Loader)
[src]
Turns the builder into the Loader
.
This parses the command line options ‒ the ones specified by the type parameter, enriched by options related to configuration (paths to config files and config overrides).
This returns the parsed options and the loader.
If the command line parsing fails, the application terminates (and prints relevant help).
pub fn build_no_opts(self) -> Loader
[src]
Turns this into the Loader
, without command line parsing.
It is similar to build
, but doesn't parse the command line, therefore
only the config_default_paths
are used to
find the config files.
This is likely useful for tests.
pub fn build_explicit_opts<O, I>(self, args: I) -> Result<(O, Loader), AnyError> where
O: StructOpt,
I: IntoIterator,
I::Item: Into<OsString> + Clone,
[src]
O: StructOpt,
I: IntoIterator,
I::Item: Into<OsString> + Clone,
Turns this into the Loader
, and command line is parsed from the provided iterator.
Similar to the build
, this returns the options and the loader. However,
the options is loaded from the provided iterator and error is explicitly returned. This
makes it better match for tests, but can be useful in other circumstances too.
Note that the 0th argument is considered to be the name of the application and is not parsed as an option.
Trait Implementations
impl ConfigBuilder for Builder
[src]
fn config_defaults<D: Into<String>>(self, config: D) -> Self
[src]
fn config_default_paths<P, I>(self, paths: I) -> Self where
I: IntoIterator<Item = P>,
P: Into<PathBuf>,
[src]
I: IntoIterator<Item = P>,
P: Into<PathBuf>,
fn config_env<E: Into<String>>(self, env: E) -> Self
[src]
fn config_filter<F: FnMut(&Path) -> bool + Send + 'static>(
self,
filter: F
) -> Self
[src]
self,
filter: F
) -> Self
fn warn_on_unused(self, warn: bool) -> Self
[src]
fn config_defaults_typed<C: Serialize>(
self,
config: &C
) -> Result<Self, AnyError>
[src]
self,
config: &C
) -> Result<Self, AnyError>
fn config_ext<E: Into<OsString>>(self, ext: E) -> Self
[src]
fn config_exts<I, E>(self, exts: I) -> Self where
I: IntoIterator<Item = E>,
E: Into<OsString>,
[src]
I: IntoIterator<Item = E>,
E: Into<OsString>,
fn config_supported_exts(self) -> Self
[src]
impl Default for Builder
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Builder
impl Send for Builder
impl !Sync for Builder
impl Unpin for Builder
impl !UnwindSafe for Builder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoResult<T> for T
[src]
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>,