This commit is contained in:
Jana Dönszelmann 2026-04-02 08:13:29 +02:00
parent 9f401bda53
commit bb8fa818d2
No known key found for this signature in database
9 changed files with 1322 additions and 78 deletions

View file

@ -6,6 +6,7 @@ impl Display for Separator {
match self {
Separator::Eq => write!(f, "="),
Separator::Colon => write!(f, ":"),
Separator::DoubleColon => write!(f, "::"),
}
}
}
@ -68,6 +69,7 @@ impl Display for PathSep {
match self {
PathSep::Slash => write!(f, "/"),
PathSep::Backslash => write!(f, "\\"),
PathSep::None => Ok(()),
}
}
}
@ -105,13 +107,20 @@ impl<'a> Display for FileName<'a> {
impl<'a> Display for Path<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let Some(drive) = &self.drive_excluding_colon {
let Self {
drive_excluding_colon,
segments,
filename,
} = self;
if let Some(drive) = &drive_excluding_colon {
write!(f, "{drive}:")?;
}
for segment in &self.segments {
for segment in segments {
write!(f, "{segment}")?;
}
write!(f, "{}", self.filename)
write!(f, "{filename}")
}
}
@ -152,7 +161,9 @@ impl<'a> Display for Token<'a> {
impl<'a> Display for Delimited<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.prefix)?;
if let Some(prefix) = &self.prefix {
write!(f, "{prefix}")?;
}
self.delimiter.fmt_start(f)?;
write!(f, "{}", self.contents)?;
self.delimiter.fmt_end(f)