Enum EscapeUnit

Source
pub enum EscapeUnit {
Show 17 variants Literal(char), DoubleQuote, SingleQuote, Backslash, Question, Alert, Backspace, Escape, FormFeed, Newline, CarriageReturn, Tab, VerticalTab, Control(u8), Octal(u8), Hex(u8), Unicode(char),
}
Expand description

Element of an EscapedString

Variants§

§

Literal(char)

Literal single character

§

DoubleQuote

Backslash-escaped double-quote character (\")

§

SingleQuote

Backslash-escaped single-quote character (\')

§

Backslash

Backslash-escaped backslash character (\\)

§

Question

Backslash-escaped question mark character (\?)

§

Alert

Backslash notation for the bell character (\a, ASCII 7)

§

Backspace

Backslash notation for the backspace character (\b, ASCII 8)

§

Escape

Backslash notation for the escape character (\e, ASCII 27)

§

FormFeed

Backslash notation for the form feed character (\f, ASCII 12)

§

Newline

Backslash notation for the newline character (\n, ASCII 10)

§

CarriageReturn

Backslash notation for the carriage return character (\r, ASCII 13)

§

Tab

Backslash notation for the horizontal tab character (\t, ASCII 9)

§

VerticalTab

Backslash notation for the vertical tab character (\v, ASCII 11)

§

Control(u8)

Control character notation (\c...)

The associated value is the control character represented by the following character in the input.

§

Octal(u8)

Single-byte octal notation (\OOO)

The associated value is the byte represented by the three octal digits following the backslash.

§

Hex(u8)

Single-byte hexadecimal notation (\xHH)

The associated value is the byte represented by the two hexadecimal digits following the x.

§

Unicode(char)

Unicode notation (\uHHHH or \UHHHHHHHH)

The associated value is the Unicode scalar value represented by the four or eight hexadecimal digits following the u or U.

Trait Implementations§

Source§

impl Clone for EscapeUnit

Source§

fn clone(&self) -> EscapeUnit

Returns a copy 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 Debug for EscapeUnit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for EscapeUnit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for EscapeUnit

Source§

type Err = Option<Error>

Optional error value

The error is None if the input is empty. A proper error is returned in Some(_) in case of a syntax error.

Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl MaybeLiteral for EscapeUnit

Source§

fn extend_literal<T: Extend<char>>( &self, result: &mut T, ) -> Result<(), NotLiteral>

Appends the literal representation of self to an extendable object. Read more
Source§

fn to_string_if_literal(&self) -> Option<String>

Checks if self is literal and, if so, converts to a string.
Source§

impl PartialEq for EscapeUnit

Source§

fn eq(&self, other: &EscapeUnit) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Unquote for EscapeUnit

Converts an escape unit into the string represented by the escape sequence.

Produces an empty string if the escape unit does not represent a valid Unicode scalar value.

Source§

fn write_unquoted<W: Write>(&self, w: &mut W) -> Result<bool, Error>

Converts self to a string with all quotes removed and writes to w.
Source§

fn unquote(&self) -> (String, bool)

Converts self to a string with all quotes removed. Read more
Source§

impl Eq for EscapeUnit

Source§

impl StructuralPartialEq for EscapeUnit

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.