use std::fmt::Display;
use std::path::Path;
use std::path::PathBuf;
#[derive(Debug)]
pub struct StripPrefixError {
pub(crate) path: PathBuf,
pub(crate) prefix: PathBuf,
}
impl StripPrefixError {
pub fn path(&self) -> &Path {
&self.path
}
pub fn prefix(&self) -> &Path {
&self.prefix
}
}
impl Display for StripPrefixError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"Path does not have prefix {}: {}",
self.prefix.display(),
self.path.display(),
)
}
}
impl std::error::Error for StripPrefixError {}