pub struct Setting {
pub section: String,
pub key: String,
pub default: Option<Value>,
pub value: Option<Value>,
pub kind: Kind,
pub secret: bool,
pub applies: Applies,
pub about: &'static str,
pub choices: &'static [&'static str],
}Expand description
One key a person can read and write: [section] key, its default and its current value.
Fields§
§section: String§key: String§default: Option<Value>What this build uses when the file does not set it. None for a key that is simply absent
until somebody sets it (provider.api_key), which is not the same as an empty string.
value: Option<Value>What the loaded config holds now. None when the key is unset.
kind: Kind§secret: boolA secret: never printed, never rendered to a page, only set.
applies: Applies§about: &'static strOne line: what this key does. See about.
choices: &'static [&'static str]The values it accepts when the set is closed. See choices.
Implementations§
Source§impl Setting
impl Setting
Sourcepub fn path(&self) -> String
pub fn path(&self) -> String
provider.model — the spelling config set takes and the surfaces show.
Sourcepub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
Whether the loaded value is the default, so a surface can say “not set here”.
Sourcepub fn rendered(&self) -> String
pub fn rendered(&self) -> String
The value as a person should see it: the TOML rendering, a redaction for a secret, or
(not set) for a key the file leaves alone.
Sourcepub fn rendered_default(&self) -> Option<String>
pub fn rendered_default(&self) -> Option<String>
The default in the same form Self::rendered uses, when this build has one for the key.
Not every absent key has a default (an API key has none), which is why it is an Option
and why config keys prints nothing rather than (not set) twice.