[go: up one dir, main page]

Simplified

Trait Simplified 

Source
pub trait Simplified {
    // Required methods
    fn simplified(&self) -> &Path;
    fn simplified_display(&self) -> impl Display;
    fn simple_canonicalize(&self) -> Result<PathBuf>;
    fn user_display(&self) -> impl Display;
    fn user_display_from(&self, base: impl AsRef<Path>) -> impl Display;
    fn portable_display(&self) -> impl Display;
}

Required Methods§

Source

fn simplified(&self) -> &Path

Simplify a Path.

On Windows, this will strip the \\?\ prefix from paths. On other platforms, it’s a no-op.

Source

fn simplified_display(&self) -> impl Display

Render a Path for display.

On Windows, this will strip the \\?\ prefix from paths. On other platforms, it’s equivalent to std::path::Display.

Source

fn simple_canonicalize(&self) -> Result<PathBuf>

Canonicalize a path without a \\?\ prefix on Windows. For a path that can’t be canonicalized (e.g. on network drive or RAM drive on Windows), this will return the absolute path if it exists.

Source

fn user_display(&self) -> impl Display

Render a Path for user-facing display.

Like [simplified_display], but relativizes the path against the current working directory.

Source

fn user_display_from(&self, base: impl AsRef<Path>) -> impl Display

Render a Path for user-facing display, where the Path is relative to a base path.

If the Path is not relative to the base path, will attempt to relativize the path against the current working directory.

Source

fn portable_display(&self) -> impl Display

Render a Path for user-facing display using a portable representation.

Like [user_display], but uses a portable representation for relative paths.

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.

Implementors§

Source§

impl<T: AsRef<Path>> Simplified for T