Path

Trait Path 

Source
pub trait Path {
    type ComponentsIter<'a>: DoubleEndedIterator<Item = &'a str>
       where Self: 'a;

    // Required method
    fn as_components(&self) -> Result<Self::ComponentsIter<'_>>;
}
Expand description

Absolute path of an item.

Either a slice of path components or a string with /-separated components. A leading slash is required for a string path, other than that the path can be empty.

Required Associated Types§

Source

type ComponentsIter<'a>: DoubleEndedIterator<Item = &'a str> where Self: 'a

Iterator over the components of the path.

Required Methods§

Source

fn as_components(&self) -> Result<Self::ComponentsIter<'_>>

An iterator over this path’s components.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Path for str

Source§

type ComponentsIter<'a> = Split<'a, char> where Self: 'a

Source§

fn as_components(&self) -> Result<Self::ComponentsIter<'_>>

Source§

impl Path for [String]

Source§

type ComponentsIter<'a> = Map<Iter<'a, String>, fn(&String) -> &str> where Self: 'a

Source§

fn as_components(&self) -> Result<Self::ComponentsIter<'_>>

Source§

impl<'b> Path for [&'b str]

Source§

type ComponentsIter<'a> = Copied<Iter<'a, &'a str>> where Self: 'a

Source§

fn as_components(&self) -> Result<Self::ComponentsIter<'_>>

Source§

impl<'b, const N: usize> Path for [&'b str; N]

Source§

type ComponentsIter<'a> = Copied<Iter<'a, &'a str>> where Self: 'a

Source§

fn as_components(&self) -> Result<Self::ComponentsIter<'_>>

Source§

impl<const N: usize> Path for [String; N]

Source§

type ComponentsIter<'a> = Map<Iter<'a, String>, fn(&String) -> &str> where Self: 'a

Source§

fn as_components(&self) -> Result<Self::ComponentsIter<'_>>

Implementors§