Skip to main content

Module escape

Module escape 

Source
Expand description

Byte-string escape decoder shared by the TOML config parser and the --action CLI surface.

Accepts these escape forms (everything else is rejected with a typed error carrying a byte offset):

  • \r -> 0x0d
  • \n -> 0x0a
  • \t -> 0x09
  • \0 -> 0x00
  • \\ -> 0x5c (literal backslash)
  • \xNN -> the byte with hex value NN (two hex digits required)

Non-ASCII input bytes pass through verbatim — strings are walked at the byte level (str::as_bytes()), so UTF-8-encoded characters land in the output buffer unchanged.

No unsafe, no panic path on operator-supplied input: every error variant carries the byte offset where the problem was detected so the UI can underline the bad character.

Enums§

EscapeError
Errors produced by decode_bytes_escape.

Functions§

decode_bytes_escape
Decode a string containing escape sequences into a byte vector.