Display in std::path - Rust (original) (raw)

Struct Display

1.0.0 · Source

pub struct Display<'a> { /* private fields */ }

Expand description

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

A Path might contain non-Unicode data. This struct implements theDisplay trait in a way that mitigates that. It is created by thedisplay 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 std::path::Path;

let path = Path::new("/tmp/foo.rs");

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

§

§

§

§

§

§