Trait flexi_parse::TokenLike
source · pub trait TokenLike {
type TokenTypes: TokenTypes;
// Provided methods
fn peek(input: ParseStream<'_>) -> bool { ... }
fn lookahead(lookahead: &Lookahead<'_>) -> bool { ... }
}Expand description
A trait for types that represent one of a few possible tokens.
This allows peeking for multiple types through the provided trait methods.
The TokenTypes type should be token, or an Either<L, R>, where L is
a token, and R is either a token or another Either<L, R> with the same
bound.
Required Associated Types§
sourcetype TokenTypes: TokenTypes
type TokenTypes: TokenTypes
The token types that this type can represent. See the trait documentation for more details.
Provided Methods§
sourcefn peek(input: ParseStream<'_>) -> bool
fn peek(input: ParseStream<'_>) -> bool
Returns true if the next token in input is any of the types in
Self::TokenTypes.
The default implementation should never be overriden.
sourcefn lookahead(lookahead: &Lookahead<'_>) -> bool
fn lookahead(lookahead: &Lookahead<'_>) -> bool
Returns true if lookahead is pointing to any of the types in
Self::TokenTypes.
The default implementation should never be overriden.