#osstr #path #print #quote #unprintable

no-std uniquote

Quote strings for clear display in output

7 releases (stable)

3.0.0 Sep 6, 2021
2.0.0 Dec 27, 2020
1.1.1 Oct 29, 2020
1.0.0 Jun 13, 2020
0.1.1 May 23, 2020

#36 in Value formatting

Download history 1/week @ 2021-07-03 1/week @ 2021-07-10 7/week @ 2021-07-17 8/week @ 2021-07-24 12/week @ 2021-07-31 106/week @ 2021-08-14 243/week @ 2021-08-21 174/week @ 2021-08-28 395/week @ 2021-09-04 31/week @ 2021-09-11 30/week @ 2021-09-18 22/week @ 2021-09-25 90/week @ 2021-10-02 31/week @ 2021-10-09

186 downloads per month
Used in os_str_bytes

MIT/Apache

33KB
524 lines

UniQuote

This crate allows quoting strings for use in output. It works similarly to str::escape_debug, but the result is meant to be shown to users. Simply call Quote::quote on an argument passed to println! or a similar macro to quote it.

One of the primary uses for this crate is displaying paths losslessly. Since Path has no Display implementation, it is usually output by calling Path::display or Path::to_string_lossy beforehand. However, both of those methods are lossy; they replace all invalid characters with REPLACEMENT_CHARACTER. This crate escapes those invalid characters instead, allowing them to always be displayed correctly.

GitHub Build Status

Usage

Add the following lines to your "Cargo.toml" file:

[dependencies]
uniquote = "3.0"

See the documentation for available functionality and examples.

Rust version support

The minimum supported Rust toolchain version is currently Rust 1.51.0.

Minor version updates may increase these version requirements. However, the previous two Rust releases will always be supported. If the minimum Rust version must not be increased, use a tilde requirement to prevent updating this crate's minor version:

[dependencies]
uniquote = "~3.0"

License

Licensing terms are specified in COPYRIGHT.

Unless you explicitly state otherwise, any contribution submitted for inclusion in this crate, as defined in LICENSE-APACHE, shall be licensed according to COPYRIGHT, without any additional terms or conditions.

No runtime deps

Features

  • alloc
  • std