diff_trees/error/
strip_prefix.rs1use std::fmt::Display;
2use std::path::Path;
3use std::path::PathBuf;
4
5#[derive(Debug)]
7pub struct StripPrefixError {
8 pub(crate) path: PathBuf,
9 pub(crate) prefix: PathBuf,
10}
11
12impl StripPrefixError {
13 pub fn path(&self) -> &Path {
15 &self.path
16 }
17
18 pub fn prefix(&self) -> &Path {
20 &self.prefix
21 }
22}
23
24impl Display for StripPrefixError {
25 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26 write!(
27 f,
28 "Path does not have prefix {}: {}",
29 self.prefix.display(),
30 self.path.display(),
31 )
32 }
33}
34
35impl std::error::Error for StripPrefixError {}