EscapeType

Enum EscapeType 

Source
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

Source§

fn clone(&self) -> EscapeType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for EscapeType

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.