[−][src]Enum domain::base::str::Symbol
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]
C: IntoIterator<Item = char>,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,