Trait AsChar

trait AsChar

Transforms a token into a char for basic string parsing

Required Methods

fn as_char(self: Self) -> char

Makes a char from self

Example

use winnow::prelude::*;

assert_eq!('a'.as_char(), 'a');
assert_eq!(u8::MAX.as_char(), std::char::from_u32(u8::MAX as u32).unwrap());
fn is_alpha(self: Self) -> bool

Tests that self is an alphabetic character

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

fn is_alphanum(self: Self) -> bool

Tests that self is an alphabetic character or a decimal digit

fn is_dec_digit(self: Self) -> bool

Tests that self is a decimal digit

fn is_hex_digit(self: Self) -> bool

Tests that self is an hex digit

fn is_oct_digit(self: Self) -> bool

Tests that self is an octal digit

fn len(self: Self) -> usize

Gets the len in bytes for self

fn is_space(self: Self) -> bool

Tests that self is ASCII space or tab

fn is_newline(self: Self) -> bool

Tests if byte is ASCII newline: \n

Implementors