Function confy::load

source ·
pub fn load<T: Serialize + DeserializeOwned + Default>(
    name: &str
) -> Result<T, IoError>
Expand description

Load an application configuration from disk

A new configuration file is created with default values if none exists.

Errors that are returned from this function are I/O related, for example if the writing of the new configuration fails or confy encounters an operating system or environment that it does not support.

Note: The type of configuration needs to be declared in some way that is inferrable by the compiler. Also note that your configuration needs to implement Default.

let cfg: MyConfig = confy::load("my-app")?;