#[non_exhaustive]pub enum ConfigLoadOutcome {
Unresolved,
NotFound {
path: PathBuf,
explicit: bool,
},
IoError {
path: PathBuf,
source: ConfigError,
warnings: Vec<String>,
},
ParseError {
path: PathBuf,
source: ConfigError,
warnings: Vec<String>,
},
Loaded {
path: PathBuf,
config: Box<Config>,
warnings: Vec<String>,
},
}Expand description
Outcome of loading the user config from a resolved path. Five variants; runtime and doctor render each differently.
Outer path is authoritative. ConfigError’s inner path is
Option<PathBuf> upstream because from_str_validated parses
in-memory strings without one — the outer field guarantees a
path here regardless of the source variant.
ParseError carries warnings because Config::load_validated
calls validate_keys between the syntactic TOML parse and the
typed try_into: unknown-key warnings can fire and then a
type-mismatch error returns. Dropping them would force users to
fix typos one at a time. IoError carries the field too for
shape symmetry; it’ll always be empty (the read fails before any
parsing).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Unresolved
No config-path source resolved. Doctor renders this as “Unresolved” (different from “NotFound” — the cascade itself failed); driver treats it as “use defaults silently.”
NotFound
Path resolved but file doesn’t exist. explicit is true
when the path came from --config / LINESMITH_CONFIG so
the diagnostic can warn loudly; implicit XDG/HOME paths are
silent for first-run users.
IoError
fs::read_to_string failed for a reason other than NotFound
(permission denied, invalid UTF-8, etc.). source carries
the underlying ConfigError for verbatim diagnostic
rendering — Display includes the path. warnings is
always empty (the read fails before validation runs).
ParseError
TOML parse or type-mismatch failed. source carries the
underlying ConfigError::Parse verbatim so the line/column
span survives to the renderer. warnings carries any
unknown-key diagnostics that fired before the typed
try_into rejected the document — see the type-level doc
for why this matters.
Loaded
Loaded successfully. warnings contains one entry per
unknown key encountered by Config::load_validated; empty
for clean configs.