Expand description
Utilities for printing paths, with special attention paid to special characters and invalid unicode.
For displaying paths in informational messages use Quotable::quote. This
will wrap quotes around the filename and add the necessary escapes to make
it copy/paste-able into a shell.
For writing raw paths to stdout when the output should not be quoted or escaped,
use println_verbatim. This will preserve invalid unicode.
§Examples
use std::path::Path;
use uucore::display::{Quotable, println_verbatim};
let path = Path::new("foo/bar.baz");
println!("Found file {}", path.quote()); // Prints "Found file 'foo/bar.baz'"
println_verbatim(path)?; // Prints "foo/bar.baz"Structs§
- Quoted
- A wrapper around string types for displaying with quoting and escaping applied.
Traits§
Functions§
- print_
all_ env_ vars - Print all environment variables in the format
name=valuewith the specified line ending. - print_
verbatim - Like
println_verbatim, without the trailing newline. - println_
verbatim - Print a path (or
OsStr-like object) directly to stdout, with a trailing newline, without losing any information if its encoding is invalid.