pub enum EscapeType {
Char(char),
NakedASCII,
NakedByte,
NakedU4,
NakedU8,
BraceU16,
BraceU18,
BracketUNamed,
Discard,
DiscardWS,
Undefined,
}
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.
BraceU16
A brace Unicode escape of 1-6 hex digits. This is used in Rust.
BraceU18
A brace Unicode escape of 1-8 hex digits with underscores permitted.
BracketUNamed
A brace 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.
Undefined
Special escape type representing an undefined escape.
Trait Implementations§
Source§impl Clone for EscapeType
impl Clone for EscapeType
Source§fn clone(&self) -> EscapeType
fn clone(&self) -> EscapeType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more