-
Notifications
You must be signed in to change notification settings - Fork 241
Open
Description
Suppose I have this config struct
#[derive(Debug, Deserialize)]
struct MyConfig {
// ...
}
impl Default for MyConfig {
fn default() -> MyConfig {
// some complex logic
}
}
I want to produce a MyConfig
, where values explicitly set in config.toml
are used, otherwise, the default implementation is used.
Something like
Config::builder().
.add_source(File::with_name("config.toml"))
.set_default(???, MyConfig::default())
.build()?;
But I couldn't figure out a way to do this. This seems like a very common use case, so I feel like I'm missing something.
TECHNOFAB11, magick93, tcbennun, av-stefan and fpoli
Metadata
Metadata
Assignees
Labels
No labels