Struct typed_path::Display

source ·
pub struct Display<'a, T>where
    T: for<'enc> Encoding<'enc>,
{ /* private fields */ }
Expand description

Helper struct for safely printing paths with format! and {}.

A Path might contain non-Unicode data. This struct implements the Display trait in a way that mitigates that. It is created by the display method on Path. This may perform lossy conversion, depending on the platform. If you would like an implementation which escapes the path please use Debug instead.

Examples

use typed_path::{Path, UnixEncoding};

// NOTE: A path cannot be created on its own without a defined encoding
let path = Path::<UnixEncoding>::new("/tmp/foo.rs");

println!("{}", path.display());

Trait Implementations§

Formats the value using the given formatter. Read more

Performs lossy conversion to UTF-8 str

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.