Peek

Trait Peek 

Source
pub(crate) trait Peek: Copy {
    // Required method
    fn matches(self, tok: TokenKind, edition: Edition) -> bool;
}
Expand description

A trait for testing whether a token matches a rule.

Required Methods§

Source

fn matches(self, tok: TokenKind, edition: Edition) -> bool

Returns true if a token matches this rule

The rule is edition dependent because keywords can vary.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Peek for Symbol

Use a Symbol to match a TokenKind::Ident equal to it.

Source§

fn matches(self, tok: TokenKind, _: Edition) -> bool

Implementors§

Source§

impl Peek for TokenKind

Use a TokenKind to match by exact equality

Source§

impl Peek for AnyLit

Source§

impl Peek for LAngle

Source§

impl Peek for NonReserved

Source§

impl Peek for RAngle

Source§

impl<F: FnOnce(TokenKind) -> bool + Copy> Peek for F

An arbitrary peek rule defined by a predicate on TokenKind

Source§

impl<T: Peek, const N: usize> Peek for AnyOf<T, N>