1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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 {}