Enum trivet::strings::EscapeType
source · pub enum EscapeType {
Char(char),
NakedASCII,
NakedByte,
NakedU4,
NakedU8,
BracketU16,
BracketU18,
BracketUNamed,
Discard,
DiscardWS,
}Expand description
Define the different escape types. These are used to interpret escape sequences found in strings and to determine how escapes are used when encoding.
Variants§
Char(char)
A character escape. For instance, this can be used to map \n to a newline.
NakedASCII
A “naked” ASCII escape of exactly two hex digits of value at most 7F. This is how
Rust handles \xNN.
NakedByte
A “naked” byte escape of exactly two hex digits of any value. This is how Python
handles \xNN.
NakedU4
A “naked” Unicode escape of exactly four hex digits. This is used in both JSON, Python, and C.
NakedU8
A “naked” Unicode escape of exactly eight digits. This is used in Python and C.
BracketU16
A bracketed Unicode escape of 1-6 hex digits. This is used in Rust.
BracketU18
A bracketed Unicode escape of 1-8 hex digits with underscores permitted.
BracketUNamed
A bracketed named Unicode escape. These are given by {n}, where n
is a name in the Unicode database. See also
Name Aliases.
The names are not case sensitive.
Discard
Discard. This can be used to join lines; for instance, some standards allow
[escape][newline] to join lines together.
DiscardWS
Discard, but also consume whitespace to the first non-whitespace character.