pub struct CharOf<M: CharClass>(pub char, _);Expand description
Matches exactly one character satisfying a character class.
Tuple Fields§
§0: charImplementations§
Trait Implementations§
impl<M: CharClass> Eq for CharOf<M>
Source§impl<M: CharClass> Grammar for CharOf<M>
impl<M: CharClass> Grammar for CharOf<M>
Source§type First = AnyCharFirst
type First = AnyCharFirst
The set of bytes (and whether empty input is valid) this grammar could start with.
Source§fn parse_at(input: &str, pos: usize, state: State<'_>) -> Option<(Self, usize)>
fn parse_at(input: &str, pos: usize, state: State<'_>) -> Option<(Self, usize)>
Attempt to parse
Self starting at pos, returning the value and the
position just past it, or None on failure.Source§fn scan_at(input: &str, pos: usize, state: State<'_>) -> Option<usize>
fn scan_at(input: &str, pos: usize, state: State<'_>) -> Option<usize>
Like
parse_at, but only checks well-formedness and
returns the end position.Source§fn to_bnf() -> Expr
fn to_bnf() -> Expr
Describe this grammar as a BNF/EBNF expression, for use in a
referencing rule’s own definition.
Source§fn fail_at(pos: usize, state: State<'_>) -> bool
fn fail_at(pos: usize, state: State<'_>) -> bool
Record what this grammar would have expected at
pos, without
attempting to actually parse — used when a caller already knows (e.g.
via First) that this alternative cannot match here, but still wants
it traced. Read moreSource§fn parse(input: &str) -> Result<Self, Error>
fn parse(input: &str) -> Result<Self, Error>
Parse the entire
input as Self, failing if any input is left unconsumed.Source§fn parse_prefix(input: &str) -> Result<(Self, usize), Error>
fn parse_prefix(input: &str) -> Result<(Self, usize), Error>
Like
parse, but doesn’t require consuming all of
input — returns the byte position just past the match, leaving any
remaining input unexamined.Source§fn scan(input: &str) -> Result<(), Error>
fn scan(input: &str) -> Result<(), Error>
Like
parse, but only checks that input is well-formed
and discards the parsed value.Auto Trait Implementations§
impl<M> Freeze for CharOf<M>
impl<M> RefUnwindSafe for CharOf<M>where
M: RefUnwindSafe,
impl<M> Send for CharOf<M>where
M: Send,
impl<M> Sync for CharOf<M>where
M: Sync,
impl<M> Unpin for CharOf<M>where
M: Unpin,
impl<M> UnsafeUnpin for CharOf<M>
impl<M> UnwindSafe for CharOf<M>where
M: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more