mod remove_dot_segments;
use crate::buffer::Buffer;
pub(crate) use self::remove_dot_segments::RemoveDotSegPath;
#[derive(Clone, Copy)]
struct PathSegment<'a> {
leading_slash: bool,
segment: &'a str,
}
impl<'a> PathSegment<'a> {
#[inline]
#[must_use]
fn has_leading_slash(&self) -> bool {
self.leading_slash
}
#[inline]
#[must_use]
fn segment(&self) -> &'a str {
self.segment
}
fn write_to<'b, B: Buffer<'b>>(&self, buf: &mut B) -> Result<(), B::ExtendError> {
if self.has_leading_slash() {
buf.push_str("/")?;
}
buf.push_str(self.segment())
}
}