Expand description
Utilities for building NATS subjects out of arbitrary tokens.
NATS reserves three characters with special meaning inside a subject:
. separates tokens, * matches a single token, and > matches one or
more trailing tokens. A token that contains any of these (for example a
Matrix room ID) would otherwise be split or interpreted as a wildcard, so
EscapingSubject escapes them (along with the escape character \
itself) when serializing and restores them when parsing.
Structs§
- Escaping
Subject - Struct that allows building a NATS subject out of tokens, escaping any reserved characters that would otherwise split up or wildcard the tokens.
Enums§
- Token
Escape Error - Errors that occur when unescaping a NATS token
Constants§
- ESCAPES 🔒
- The single source of truth for NATS reserved characters and their escape
codes, as
(literal, escape-code)pairs. Escaping looks a character up by its literal; unescaping looks it up by its code. - ESCAPE_
CHAR 🔒 - The character that introduces an escape sequence.
Functions§
- escape_
token - Escape every NATS-reserved character in a token (see
ESCAPES) so it survives being placed in a subject. - unescape_
token - Unescape a string that has been escaped with escape_token