Trait typed_path::Utf8Component 
source · pub trait Utf8Component<'a>: AsRef<str> + Clone + Debug + PartialEq + Eq + PartialOrd + Ord + Sealed {
    // Required methods
    fn as_str(&self) -> &'a str;
    fn is_root(&self) -> bool;
    fn is_normal(&self) -> bool;
    fn is_parent(&self) -> bool;
    fn is_current(&self) -> bool;
    fn len(&self) -> usize;
    fn root() -> Self;
    fn parent() -> Self;
    fn current() -> Self;
    // Provided method
    fn is_empty(&self) -> bool { ... }
}Expand description
Interface representing a component in a Utf8Path
Required Methods§
sourcefn is_root(&self) -> bool
 
fn is_root(&self) -> bool
Returns true if this component is the root component, meaning there are no more components before this one
Use cases are for the root dir separator on Windows and Unix as
well as Windows std::path::PrefixComponent
Examples
/my/../path/./here.txt has the components on Unix of
UnixComponent::RootDir-is_root() == trueUnixComponent::ParentDir-is_root() == falseUnixComponent::CurDir-is_root() == falseUnixComponent::Normal("here.txt")-is_root() == false
sourcefn is_normal(&self) -> bool
 
fn is_normal(&self) -> bool
Returns true if this component represents a normal part of the path
Examples
/my/../path/./here.txt has the components on Unix of
UnixComponent::RootDir-is_normal() == falseUnixComponent::ParentDir-is_normal() == falseUnixComponent::CurDir-is_normal() == falseUnixComponent::Normal("here.txt")-is_normal() == true
sourcefn is_parent(&self) -> bool
 
fn is_parent(&self) -> bool
Returns true if this component represents a relative representation of a parent directory
Examples
/my/../path/./here.txt has the components on Unix of
UnixComponent::RootDir-is_parent() == falseUnixComponent::ParentDir-is_parent() == trueUnixComponent::CurDir-is_parent() == falseUnixComponent::Normal("here.txt")-is_parent() == false
sourcefn is_current(&self) -> bool
 
fn is_current(&self) -> bool
Returns true if this component represents a relative representation of the current directory
Examples
/my/../path/./here.txt has the components on Unix of
UnixComponent::RootDir-is_current() == falseUnixComponent::ParentDir-is_current() == falseUnixComponent::CurDir-is_current() == trueUnixComponent::Normal("here.txt")-is_current() == false
sourcefn root() -> Self
 
fn root() -> Self
Returns a root Utf8Component.
sourcefn parent() -> Self
 
fn parent() -> Self
Returns a parent directory Utf8Component.
sourcefn current() -> Self
 
fn current() -> Self
Returns a current directory Utf8Component.