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.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.