rustmax::nom

Trait AsChar

Source
pub trait AsChar: Copy {
    // Required methods
    fn as_char(self) -> char;
    fn is_alpha(self) -> bool;
    fn is_alphanum(self) -> bool;
    fn is_dec_digit(self) -> bool;
    fn is_hex_digit(self) -> bool;
    fn is_oct_digit(self) -> bool;
    fn is_bin_digit(self) -> bool;
    fn len(self) -> usize;
    fn is_space(self) -> bool;
    fn is_newline(self) -> bool;
}
Expand description

Transforms common types to a char for basic token parsing

Required Methods§

Source

fn as_char(self) -> char

makes a char from self

Source

fn is_alpha(self) -> bool

Tests that self is an alphabetic character

Warning: for &str it recognizes alphabetic characters outside of the 52 ASCII letters

Source

fn is_alphanum(self) -> bool

Tests that self is an alphabetic character or a decimal digit

Source

fn is_dec_digit(self) -> bool

Tests that self is a decimal digit

Source

fn is_hex_digit(self) -> bool

Tests that self is an hex digit

Source

fn is_oct_digit(self) -> bool

Tests that self is an octal digit

Source

fn is_bin_digit(self) -> bool

Tests that self is a binary digit

Source

fn len(self) -> usize

Gets the len in bytes for self

Source

fn is_space(self) -> bool

Tests that self is ASCII space or tab

Source

fn is_newline(self) -> bool

Tests if byte is ASCII newline: \n

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl AsChar for char

Source§

impl AsChar for u8

Source§

impl<'a> AsChar for &'a char

Source§

impl<'a> AsChar for &'a u8

Implementors§