use std::{ffi::OsStr, fmt, hash::Hash};
pub trait PathSegment: Eq + Hash + fmt::Debug {
#[must_use]
fn is_empty(&self) -> bool;
}
impl PathSegment for str {
fn is_empty(&self) -> bool {
self.is_empty()
}
}
impl PathSegment for OsStr {
fn is_empty(&self) -> bool {
self.is_empty()
}
}
pub trait SegmentedPath<S: PathSegment + ?Sized>: Clone + Eq + Hash + fmt::Debug {
#[must_use]
fn segments(&self) -> Box<dyn Iterator<Item = &S> + '_>;
#[must_use]
fn parent_child_segments(&self) -> (Box<dyn Iterator<Item = &S> + '_>, Option<&S>);
}
pub trait RootPath<S: PathSegment + ?Sized>: SegmentedPath<S> {
#[must_use]
fn is_root(&self) -> bool;
}