[][src]Enum domain::base::str::Symbol

pub enum Symbol {
    Char(char),
    SimpleEscape(char),
    DecimalEscape(u8),
}

The master file representation of a single character.

This is either a regular character or an escape sequence. See the variants for more details.

Variants

Char(char)

An unescaped Unicode character.

SimpleEscape(char)

A character escaped via a preceding backslash.

DecimalEscape(u8)

A raw octet escaped using the decimal escape sequence.

This escape sequence consists of a backslash followed by exactly three decimal digits with the value of the octets.

Implementations

impl Symbol[src]

pub fn from_chars<C>(chars: C) -> Result<Option<Self>, SymbolError> where
    C: IntoIterator<Item = char>, 
[src]

Reads a symbol from a character source.

Returns the next symbol in the source, Ok(None) if the source has been exhausted, or an error if there wasn’t a valid symbol.

pub fn from_octet(ch: u8) -> Self[src]

Provides the best symbol for an octet.

The function will use the simple escape sequence for octet values that represent ASCII spaces, quotes, backslashes, and semicolons and the plain ASCII value for all other printable ASCII characters. Any other value is escaped using the decimal escape sequence.

pub fn into_octet(self) -> Result<u8, BadSymbol>[src]

Converts the symbol into an octet if it represents one.

Both domain names and character strings operate on bytes instead of (Unicode) characters. These bytes can be represented by printable ASCII characters (that is, U+0020 to U+007E), both plain or through a simple escape, or by a decimal escape.

This method returns such an octet or an error if the symbol doesn’t have value representing an octet. Note that it will succeed for an ASCII space character U+0020 which may be used as a word separator in some cases.

pub fn into_char(self) -> Result<char, BadSymbol>[src]

Converts the symbol into a char.

This will fail for a decimal escape sequence which doesn’t actually represent a character.

pub fn into_digit(self, base: u32) -> Result<u32, BadSymbol>[src]

Converts the symbol representing a digit into its integer value.

pub fn is_word_char(self) -> bool[src]

Returns whether the symbol can occur as part of a word.

This is true apart for unescaped ASCII space and horizontal tabs, opening and closing parantheses, the semicolon, and double quote.

Trait Implementations

impl Clone for Symbol[src]

impl Copy for Symbol[src]

impl Debug for Symbol[src]

impl Display for Symbol[src]

impl Eq for Symbol[src]

impl From<char> for Symbol[src]

impl PartialEq<Symbol> for Symbol[src]

impl StructuralEq for Symbol[src]

impl StructuralPartialEq for Symbol[src]

Auto Trait Implementations

impl RefUnwindSafe for Symbol

impl Send for Symbol

impl Sync for Symbol

impl Unpin for Symbol

impl UnwindSafe for Symbol

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,