Trait nom8::input::AsChar

source ·
pub trait AsChar {
    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 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§

Makes a char from self

use nom8::input::AsChar as _;

assert_eq!('a'.as_char(), 'a');
assert_eq!(u8::MAX.as_char(), std::char::from_u32(u8::MAX as u32).unwrap());

Tests that self is an alphabetic character

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

Tests that self is an alphabetic character or a decimal digit

Tests that self is a decimal digit

Tests that self is an hex digit

Tests that self is an octal digit

Gets the len in bytes for self

Tests that self is ASCII space or tab

Tests if byte is ASCII newline: \n

Implementations on Foreign Types§

Implementors§