pub trait AsUriPath {
fn as_uri_path(&self) -> impl Iterator<Item = &str>;
}
impl<'b> AsUriPath for &[&'b str] {
fn as_uri_path(&self) -> impl Iterator<Item = &str> {
self.iter().map(core::ops::Deref::deref)
}
}
impl AsUriPath for &str {
fn as_uri_path(&self) -> impl Iterator<Item = &str> {
assert!(self.bytes().next() == Some(b'/'));
let slice = self
.split('?')
.next()
.expect("Non-empty strings can be split")
.split('#')
.next()
.expect("Non-emptyh strings can be split");
let mut iter = slice.split('/');
let _empty = iter.next();
iter
}
}