pub struct Loader {
pub name: &'static str,
pub env_prefix: &'static str,
pub search: ConfigSearch,
}Expand description
The application selects its namespace and schema; the loader owns sources.
Fields§
§name: &'static str§env_prefix: &'static str§search: ConfigSearchImplementations§
Source§impl Loader
impl Loader
pub const fn new(name: &'static str, env_prefix: &'static str) -> Self
pub const fn explicit_only(self) -> Self
pub fn load<T: ConfSerde>(&self) -> Result<Loaded<T>, ConfigError>
Sourcepub fn load_from<T: ConfSerde>(
&self,
args: impl IntoIterator<Item = impl Into<OsString>>,
env: impl IntoIterator<Item = (impl Into<OsString>, impl Into<OsString>)>,
) -> Result<Loaded<T>, ConfigError>
pub fn load_from<T: ConfSerde>( &self, args: impl IntoIterator<Item = impl Into<OsString>>, env: impl IntoIterator<Item = (impl Into<OsString>, impl Into<OsString>)>, ) -> Result<Loaded<T>, ConfigError>
Uses a snapshot so parsing and interpolation see exactly the same inputs.
Sourcepub fn environment_warnings<T: Conf>(
&self,
env: &[(OsString, OsString)],
) -> Vec<String>
pub fn environment_warnings<T: Conf>( &self, env: &[(OsString, OsString)], ) -> Vec<String>
Warns about unknown names in this application’s namespace, in stable order.
Sourcepub fn config_paths(&self) -> Vec<PathBuf>
pub fn config_paths(&self) -> Vec<PathBuf>
Discovery order is working directory, local config, roaming config,
then, on Unix, the system-wide /etc/<name>/<name>.toml where a
packaged service conventionally keeps it.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Loader
impl RefUnwindSafe for Loader
impl Send for Loader
impl Sync for Loader
impl Unpin for Loader
impl UnsafeUnpin for Loader
impl UnwindSafe for Loader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more