quote_bytes_string

Function quote_bytes_string 

Source
pub fn quote_bytes_string(s: &[u8]) -> String
Expand description

quote_bytes_string is similar to Quote, but takes slice of bytes instead of a string. This is useful in cases when replacing Go Quote function when the Go string contains arbitrary data (in Go strings can contain arbitrary data, in Rust they cannot).

Examples found in repository?
examples/base64.rs (line 57)
50fn example_encoding_decode_string() {
51    let str = "c29tZSBkYXRhIHdpdGggACBhbmQg77u/";
52    let (data, err) = base64::get_std_encoding().decode_string(str);
53    if err.is_some() {
54        println!("error: {:?}", err);
55        return;
56    }
57    println!("{}", ggstd::strconv::quote_bytes_string(&data));
58    // Output:
59    // "some data with \x00 and \ufeff"
60}