pub struct PersistError {
pub error: Error,
pub path: PathBuf,
}Expand description
The error returned by crate::TempFile::persist and
crate::TempDir::persist when the move to the target path fails.
On failure the temporary file or directory is not deleted: it is left in
place at PersistError::path so the caller can recover the data instead of
losing it. To restore automatic cleanup, re-wrap that path with
from_existing(path, Ownership::Owned).
There is intentionally no From<PersistError> for Error conversion: a
blanket ? would silently drop PersistError::path, the one piece of
information that makes recovery possible. Handle the two fields explicitly,
or use map_err(|e| e.error) if you only care about the underlying error.
Fields§
§error: ErrorThe underlying error that prevented the move (for example a cross-device rename, a permission error, or a missing target directory).
path: PathBufThe path at which the temporary file or directory still resides.
Trait Implementations§
Source§impl Debug for PersistError
impl Debug for PersistError
Source§impl Display for PersistError
impl Display for PersistError
Source§impl Error for PersistError
impl Error for PersistError
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()