diff options
Diffstat (limited to 'src/uri.rs')
-rw-r--r-- | src/uri.rs | 32 |
1 files changed, 16 insertions, 16 deletions
@@ -31,6 +31,22 @@ impl Uri { self.authority.as_ref() } + fn can_navigate_path_up_one_level<T>(path: T) -> bool + where T: AsRef<[Vec<u8>]> + { + let path = path.as_ref(); + match path.first() { + // First segment empty means path has leading slash, + // so we can only navigate up if there are two or more segments. + Some(segment) if segment.is_empty() => path.len() > 1, + + // Otherwise, we can navigate up as long as there is at least one + // segment. + Some(_) => true, + None => false + } + } + fn check_scheme<T>(scheme: T) -> Result<T, Error> where T: AsRef<str> { @@ -60,22 +76,6 @@ impl Uri { !Self::is_path_absolute(&self.path) } - fn can_navigate_path_up_one_level<T>(path: T) -> bool - where T: AsRef<[Vec<u8>]> - { - let path = path.as_ref(); - match path.first() { - // First segment empty means path has leading slash, - // so we can only navigate up if there are two or more segments. - Some(segment) if segment.is_empty() => path.len() > 1, - - // Otherwise, we can navigate up as long as there is at least one - // segment. - Some(_) => true, - None => false - } - } - fn decode_query_or_fragment<T>( query_or_fragment: T, context: Context, |