#[derive(OverrideConfig)]
{
// Attributes available to this derive:
#[override_opts]
}
Expand description
Sections in the configuration file can use #[derive(OverrideConfig)]
to generate the
implementation of overwriting configs from the file.
In the struct definition, use #[override_opts(path = …)] on a field to indicate the field in
RwConfig
to override.
An example:
ⓘ
#[derive(OverrideConfig)]
struct Opts {
#[override_opts(path = meta.listen_addr)]
listen_addr: Option<String>,
}
will generate
ⓘ
impl OverrideConfig for Opts {
fn r#override(self, config: &mut RwConfig) {
if let Some(v) = self.required_str {
config.meta.listen_addr = v;
}
}
}