Skip to main content

ConfigLoadOutcome

Enum ConfigLoadOutcome 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

Fields

§path: PathBuf
§explicit: bool
§

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).

Fields

§path: PathBuf
§warnings: Vec<String>
§

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.

Fields

§path: PathBuf
§warnings: Vec<String>
§

Loaded

Loaded successfully. warnings contains one entry per unknown key encountered by Config::load_validated; empty for clean configs.

Fields

§path: PathBuf
§config: Box<Config>
§warnings: Vec<String>

Trait Implementations§

Source§

impl Debug for ConfigLoadOutcome

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.