Enum cfg_rs::ConfigValue [−][src]
pub enum ConfigValue<'a> {
StrRef(&'a str),
Str(String),
Int(i64),
Float(f64),
Bool(bool),
Rand(RandValue),
}Expand description
Config value, ConfigSource use this value to store config properties.
Placeholder expression
Placeholder expression use normalized string representation of crate::ConfigKey, with extra brackets.
For example: ${cfg.k1}.
Placeholder expression is powerful in realworld application, it has following benifits:
Placeholder can reduce duplicated configs, use one key config to affect multiple keys.
app.name=cfgapp.version=1.0.0app.desc=Application ${app.name}, version ${app.version}
Placeholder can generate configs, we can use placeholder to generate random values.
app.id=${random.u64}app.instance=${app.name}-${app.id}
Variants
String reference, supports placeholder expression.
Tuple Fields of StrRef
0: &'a strString, supports placeholder expression.
Tuple Fields of Str
0: StringInteger.
Tuple Fields of Int
0: i64Float value.
Tuple Fields of Float
0: f64Bool value.
Tuple Fields of Bool
0: boolRandom value.
Trait Implementations
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.