#[non_exhaustive]pub enum ThemeError {
Read {
path: String,
source: Error,
},
Write {
path: String,
source: Error,
},
Parse {
path: String,
source: Error,
},
Serialize(Error),
}Expand description
What went wrong reading, writing or (de)serialising a Theme.
#[non_exhaustive] here and nowhere else in this file: on an enum it
only forces external matches to carry a _ arm, so a fifth failure
mode can be added later without an API break. On a struct the same
attribute blocks external construction outright — even
Theme { accent, ..Default::default() } fails to compile outside
this crate — which is why Theme, Surfaces and Color do not get
it: callers build those with struct-update syntax today, and freezing
that would break every one of them.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Read
The file exists but couldn’t be opened or read — permissions, a
vanished mount, that kind of thing. Not raised for a missing file,
which Theme::load treats as the default instead.
Write
The write itself failed — Theme::save or Theme::export
couldn’t create the file, copy the wallpaper, or rename the temp
file into place.
Parse
The file was read but isn’t valid TOML, or its shape doesn’t match
Theme — a half-written file, most likely, since every field
defaults and a merely incomplete one parses fine.
Serialize(Error)
Turning a Theme into TOML failed before any write was
attempted. In practice this shouldn’t happen — every field is a
plain serialisable type — but toml::to_string_pretty returns a
Result, so this variant exists to carry that error rather than
unwrap it.
Trait Implementations§
Source§impl Debug for ThemeError
impl Debug for ThemeError
Source§impl Display for ThemeError
impl Display for ThemeError
Source§impl Error for ThemeError
impl Error for ThemeError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()