#[non_exhaustive]pub enum SaveError {
Serialize {
path: PathBuf,
source: Error,
},
Write {
path: PathBuf,
source: Error,
},
Inconsistent {
reason: String,
},
Conflict {
path: PathBuf,
},
Read {
path: PathBuf,
source: Error,
},
}Expand description
Failure during Workspace::save.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Serialize
A TOML file failed to serialise.
Write
Writing the serialised TOML to disk failed.
Inconsistent
The workspace’s internal state was inconsistent at save time — usually a programmer error in the edit layer.
Conflict
The file changed on disk since it was last loaded or saved. In-place editing (RFC 056) re-reads the text it mutates, so it notices this where the old rebuild-from-model path could not. Overwriting would silently discard whatever changed it made — the caller must reload and reapply instead.
Read
Re-reading a file to check it for external changes (RFC 056 §2
Q3, ahead of an in-place save) failed — permission denied, the
file deleted out from under us, etc. Distinct from Conflict:
this is “we couldn’t tell whether it changed,” not “we could
tell, and it did.” Reloading — Conflict’s remedy — will not
fix a permission error, so the two need different messages.
Implementations§
Trait Implementations§
Source§impl Error for SaveError
impl Error for SaveError
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()