pub struct LoadMessage {
pub level: LoadMessageLevel,
pub source: PathBuf,
pub body: String,
pub option: Option<String>,
}Expand description
One diagnostic from the loader. Caller decides how to surface it (echo, message buffer, log line); the loader stays IO-agnostic.
Fields§
§level: LoadMessageLevelWhether the whole file was lost (LoadMessageLevel::Error) or
one key was rejected (LoadMessageLevel::Warning).
source: PathBufThe file the diagnostic came from.
body: StringHuman-readable reason, without the path prefix — the caller
formats source and body together.
option: Option<String>OC.11c: the dotted option name this diagnostic is ABOUT, when it is about one.
The name was always available at every site that builds one of these —
it is dotted, and it was being formatted into body
and nowhere else. Keeping it structurally is what lets a consumer ask
“did MY option fail to load” without matching a substring against a
message written for a human.
None for a diagnostic that is not about a single option: a file that
could not be read, or whose TOML did not parse. Those are not
per-option failures and must not be attributed to one — a syntax
error loses the WHOLE file, every option in it, and reporting it
against whichever option happened to be nearby would be worse than
saying nothing.
Trait Implementations§
Source§impl Clone for LoadMessage
impl Clone for LoadMessage
Source§fn clone(&self) -> LoadMessage
fn clone(&self) -> LoadMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more