use std::error::Error;
use std::fmt;
use std::fmt::Display;
use std::fmt::Formatter;
use std::path::Path;
use std::path::PathBuf;
#[derive(Debug, PartialEq)]
pub struct MissingPrefixError(pub(super) ());
impl Display for MissingPrefixError {
#[inline]
fn fmt(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
"normpath: path is missing a prefix".fmt(formatter)
}
}
impl Error for MissingPrefixError {}
#[derive(Debug, PartialEq)]
pub struct MissingPrefixBufError(pub(super) PathBuf);
impl MissingPrefixBufError {
#[inline]
#[must_use]
pub fn as_path(&self) -> &Path {
&self.0
}
#[inline]
#[must_use]
pub fn into_path_buf(self) -> PathBuf {
self.0
}
}
impl Display for MissingPrefixBufError {
#[inline]
fn fmt(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
write!(
formatter,
"normpath: path is missing a prefix: {}",
self.0.display(),
)
}
}
impl Error for MissingPrefixBufError {}
#[derive(Debug, PartialEq)]
pub struct ParentError(pub(super) ());
impl Display for ParentError {
#[inline]
fn fmt(&self, formatter: &mut Formatter<'_>) -> fmt::Result {
"normpath: cannot remove the path's last component".fmt(formatter)
}
}
impl Error for ParentError {}