Escaping
Escaping is a general purpose escaping library that is const compatible (for the configuration). You can configure an escape character, a set of characters you want to escape, and a set of translations you want to use for escaped characters (for example to handle non printable characters). It provides,
- bi directional escape and unescape methods based on your configuration
- escaping aware split, and splitn methods
- configurable translations of escaped characters to ascii sequences and back
- generic escaping and unescaping of arbitrary characters to and from \u{HHHH} format
- options to avoid allocation by supplying the target buffer
Say you are writing a compiler and you want to implement interpolation of expressions surrounded by [] in string literals, as well as C like escapes, and escaping of any remaining control characters to generic \u{HHHH} format.
use Escape;
const ESC: = const_new;