use super::VirtualPath;
use std::fmt;
pub struct VirtualPathDisplay<'vpath, Marker>(pub(super) &'vpath VirtualPath<Marker>);
impl<'vpath, Marker> fmt::Display for VirtualPathDisplay<'vpath, Marker> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use std::path::Component;
let mut parts: Vec<String> = Vec::new();
for comp in self.0.virtual_path.components() {
if let Component::Normal(name) = comp {
let s = name.to_string_lossy();
parts.push(super::sanitize_display_component(&s));
}
}
if parts.is_empty() {
write!(f, "/")
} else {
write!(f, "/{}", parts.join("/"))
}
}
}