Expand description
A derive-based config parser aimed at the practically-minded developer building large web projects and applications.
To use conf, use the #[derive(Conf)] proc macro on your configuration struct.
Then call a Conf trait function to parse your configuration struct.
Proc macro attributes are documented there.
For hierarchical config, add the #[conf(serde)] annotation to your configuration struct.
Then use Conf::conf_builder to get a builder object, and call ConfBuilder::doc
to supply a serde “document” representing the config file in any serde-compatible format.
A typical example might be a serde_json::Value.
Then call ConfBuilder::parse or similar on the builder.
See the readme for an overview.
Re-exports§
pub use anstyle;
Modules§
- introspection
- Facilities for introspecting on Conf structures and the Conf process
- readme
- The README for the
confcrate.
Structs§
- Conf
Builder - A builder which collects config value sources and other options, before parsing your struct.
- Conf
Serde Builder - A ConfBuilder which additionally has serde-document content installed.
- Error
- An error which occurs when a
Conf::parsefunction is called. This may conceptually represent many underlying errors of several different types. - Styles
- Terminal styling definitions for help text output.
Traits§
- Conf
- The Conf trait is implemented by types that represent a collection of config parsed on startup,
and is modeled on
clap::Parser. - Conf
Serde - Extension to Conf trait with serde-integration implementation details.
- Subcommands
- The Subcommands trait represents one or more subcommands that can be added to a
Confstructure. To use it, put#[derive(Subcommands)]on your enum, and then add a#[conf(subcommands)]field to yourConfstructure whose type is your enum type, orOption<T>whereTis your enum type.
Functions§
- find_
parameter - In some cases, you may want to grab a config file path from CLI args before doing the main parse, so that you can load the config file content and pass it to conf::conf_builder(), if the config file path was present.