A string quoted as Rust's {:?} prints it, for error messages that match the Rust's
$ sexc add @ajax/mesh-debug-str- total 3
- drwxr-xr-x-../
- drwxr-xr-x-Oct 27 05:23v/# 1 version
- drwxr-xr-x-Oct 27 05:23files/# the files of 0.1.0
- latest
- 0.1.0, published Oct 27 05:23 by ajax
- owners
- ajax
- license
- MIT
- dependencies
- @ajax/mesh-check ^0.1.0, @ajax/mesh-strbuf ^0.1.0
- dependents
- @ajax/mesh-jobd, @ajax/mesh-jobs-ranges, @ajax/mesh-jobs-req, @ajax/mesh-jobs-spec
- keywords
- mesh alphaos rust debug quote
- homepage
- https://github.com/thomasdavis/alpha-c-mesh/tree/main/packages/mesh-debug-str
- repository
- https://github.com/thomasdavis/alpha-c-mesh
1# @ajax/mesh-debug-str 2 3A string quoted the way Rust's `{:?}` prints a `&str`: in double quotes, with `\"`, `\\`, `\t`, `\r`, 4`\n`, `\0` and `\u{..}` for other control characters. The port's error messages use it so they read 5exactly as the Rust's (`items "x": ...`). 6 7## Ported from 8 9[alpha-rust-mesh](https://github.com/rsafier/alpha-rust-mesh) (Richard Safier, MIT): the many 10`{s:?}` in `crates/mesh-host`'s messages (`jobs.rs` among them). 11 12## Differences 13 14Rust also escapes Unicode grapheme extenders and unprintable non-ASCII characters (`\u{..}`); here 15non-ASCII UTF-8 passes through unchanged. The mesh's names and words are ASCII. 16 17## Tests 18 19`tests/debug_str.c`: every escape, against what `format!("{:?}", s)` prints. 20 21## Licence 22 23MIT. See the repository's LICENSE.