Skip to main content

AsPath

Trait AsPath 

Source
pub trait AsPath {
    // Required method
    fn as_path(&self) -> Path<'_>;
}
Expand description

A trait for types that can be converted to a Path.

When providing a String/str, any leading/trailing slashes are trimmed and multiple consecutive slashes are collapsed. When already a Path, normalization is skipped and the underlying buffer is reused without copying.

Required Methods§

Source

fn as_path(&self) -> Path<'_>

Borrow self as a Path, normalizing slashes only when needed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AsPath for String

Source§

fn as_path(&self) -> Path<'_>

Source§

impl<'a> AsPath for &'a String

Source§

fn as_path(&self) -> Path<'a>

Source§

impl<'a> AsPath for &'a str

Source§

fn as_path(&self) -> Path<'a>

Implementors§

Source§

impl AsPath for Path<'_>

Source§

impl<'a> AsPath for &'a Path<'a>