pub enum RedoxPath<'a> {
Standard(RedoxReference<'a>),
Legacy(RedoxScheme<'a>, RedoxReference<'a>),
}Expand description
A fully qualified Redox path
Variants§
Standard(RedoxReference<'a>)
Standard UNIX compatible format
Legacy(RedoxScheme<'a>, RedoxReference<'a>)
Legacy URI format
Implementations§
Source§impl<'a> RedoxPath<'a>
impl<'a> RedoxPath<'a>
Sourcepub fn from_absolute(path: &'a str) -> Option<Self>
pub fn from_absolute(path: &'a str) -> Option<Self>
Create RedoxPath from absolute path
Returns Some on success and None if the path is not valid
Sourcepub fn join(&self, path: &'a str) -> Option<Self>
pub fn join(&self, path: &'a str) -> Option<Self>
Join a RedoxPath with a &str path. Relative paths will be appended to self,
absolute paths will be returned as a RedoxPath, ignoring self.
Returns Some on success and None if the path is not valid
Sourcepub fn canonical(&self) -> Option<Self>
pub fn canonical(&self) -> Option<Self>
Canonicalize path, removing . and ..
Returns Some on success and None if the path is not valid
Sourcepub fn is_canon(&self) -> bool
pub fn is_canon(&self) -> bool
Verify that the path is canonicalized.
Returns false if any segment is “.”, “..” or “”. A path that is empty is allowed and is interpreted as “/”. Legacy paths are assumed to be canonical.
Sourcepub fn as_parts(&'a self) -> Option<(RedoxScheme<'a>, RedoxReference<'a>)>
pub fn as_parts(&'a self) -> Option<(RedoxScheme<'a>, RedoxReference<'a>)>
Convert into a RedoxScheme and RedoxReference.
- Standard paths will parse
/scheme/scheme_name/reference, and anything not starting with/schemewill be parsed as being part of thefilescheme - Legacy paths can be instantly converted
Sourcepub fn matches_scheme(&self, other: &str) -> bool
pub fn matches_scheme(&self, other: &str) -> bool
Is the scheme for this path the same as the given string?
Sourcepub fn is_scheme_category(&self, category: &str) -> bool
pub fn is_scheme_category(&self, category: &str) -> bool
Does the scheme match the given category, e.g. “disk-”
Sourcepub fn is_default_scheme(&self) -> bool
pub fn is_default_scheme(&self) -> bool
Is this the default scheme, “/scheme/file”?
Sourcepub fn to_standard(&self) -> String
pub fn to_standard(&self) -> String
Format a RedoxPath into a UNIX style path
Sourcepub fn to_standard_canon(&self) -> Option<String>
pub fn to_standard_canon(&self) -> Option<String>
Format a RedoxPath into a UNIX style path,
ensuring it is canonicalized