diff_trees/error/
walkdir_metadata.rs1use std::fmt::Display;
2use std::path::Path;
3use std::path::PathBuf;
4
5#[derive(Debug)]
8pub struct WalkDirMetadataError {
9 pub(crate) path: PathBuf,
10 pub(crate) inner: walkdir::Error,
11}
12
13impl WalkDirMetadataError {
14 pub fn path(&self) -> &Path {
16 &self.path
17 }
18}
19
20impl Display for WalkDirMetadataError {
21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 write!(
23 f,
24 "Failed to query metadata for `{}`: {}",
25 self.path.display(),
26 self.inner
27 )
28 }
29}
30
31impl std::error::Error for WalkDirMetadataError {
32 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
33 Some(&self.inner)
34 }
35}