Trait winnow::stream::AsChar

source ·
pub trait AsChar {
    // 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 len(self) -> usize;
    fn is_space(self) -> bool;
    fn is_newline(self) -> bool;
}
Expand description

Transforms a token into a char for basic string parsing

Required Methods§

source

fn as_char(self) -> char

Makes a char from self

§Example
use winnow::stream::AsChar as _;

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

fn is_alpha(self) -> bool

Tests that self is an alphabetic character

Warning: for &str it matches 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 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

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§