Skip to main content

println_verbatim

Function println_verbatim 

Source
pub fn println_verbatim<S: AsRef<OsStr>>(text: S) -> Result<()>
Expand description

Print a path (or OsStr-like object) directly to stdout, with a trailing newline, without losing any information if its encoding is invalid.

This function is appropriate for commands where printing paths is the point and the output is likely to be captured, like pwd and basename. For informational output use Quotable::quote.

FIXME: Invalid Unicode will produce an error on Windows. That could be fixed by using low-level library calls and bypassing io::Write. This is not a big priority because broken filenames are much rarer on Windows than on Unix.