Trait abscissa::GlobalConfig[][src]

pub trait GlobalConfig: 'static + Clone + DeserializeOwned {
    fn get_global() -> ConfigReader<Self>;
fn set_global(config: Self); fn load_toml<T: AsRef<str>>(toml_string: T) -> Result<Self, FrameworkError> { ... }
fn load_toml_file<P>(path: &P) -> Result<Self, FrameworkError>
    where
        P: AsRef<CanonicalPath>
, { ... }
fn set_from_toml_file<P>(
        path: &P
    ) -> Result<ConfigReader<Self>, FrameworkError>
    where
        P: AsRef<CanonicalPath>
, { ... }
fn set_from_toml_file_or_exit<P>(path: &P) -> ConfigReader<Self>
    where
        P: AsRef<CanonicalPath>
, { ... }
fn not_loaded() -> ! { ... } }

Common functions for loading and reading application configuration from TOML files (providing a global lock which allows many readers, and can be automatically implemented using the impl_global_config! macro.

Required Methods

Get the global configuration, acquiring a lock around it. If the configuration hasn't been loaded, calls Self::not_loaded().

Set the global configuration to the given value

Provided Methods

Load the configuration from the given TOML string

Load the global configuration from the TOML file at the given path. If an error occurs reading or parsing the file, print it out and exit.

Parse the given TOML file and set the global configuration to the result

Load the given TOML configuration file, printing an error message and exiting if it's invalid

Error handler called if Self::get() is invoked before the global configuration has been loaded. This indicates a bug in the program accessing this type.

Implementors