pub struct PathError {
pub op: Op,
pub path: PathBuf,
pub second_path: Option<PathBuf>,
/* private fields */
}Expand description
Downcast target for structured error context.
Filesystem errors returned by this crate are io::Error values whose
payload is a PathError. Invalid options return an error without path
context. Display renders "<op> <path>[ -> <second>]: <source error>", and Error::source() yields the underlying io::Error.
use dir_tree_ops::{copy_tree, Options, PathError};
let err = copy_tree("/no/such/tree", "/tmp/out", &Options::default()).unwrap_err();
let ctx: &PathError = err.get_ref().unwrap().downcast_ref().unwrap();
assert!(ctx.path.ends_with("tree"));Fields§
§op: OpThe step that failed.
path: PathBufThe path the step was acting on.
second_path: Option<PathBuf>The other path involved, for steps that take two.
Trait Implementations§
Source§impl Error for PathError
impl Error for PathError
Source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for PathError
impl !UnwindSafe for PathError
impl Freeze for PathError
impl Send for PathError
impl Sync for PathError
impl Unpin for PathError
impl UnsafeUnpin for PathError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more