Tracker

Trait Tracker 

Source
pub trait Tracker {
    type Error;

    // Required methods
    fn increase_token(&mut self);
    fn increase_recursion(&mut self);
    fn decrease_recursion(&mut self);
    fn check(&self) -> Result<(), Self::Error>;

    // Provided methods
    fn increase_token_and_decrease_recursion(&mut self) { ... }
    fn increase_token_and_decrease_recursion_and_check(
        &mut self,
    ) -> Result<(), Self::Error> { ... }
    fn increase_token_and_check(&mut self) -> Result<(), Self::Error> { ... }
    fn increase_both(&mut self) { ... }
    fn increase_both_and_check(&mut self) -> Result<(), Self::Error> { ... }
}
Expand description

A tracker that combines both token and recursion tracking.

Required Associated Types§

Source

type Error

The error type returned when either limit is exceeded.

Required Methods§

Source

fn increase_token(&mut self)

Increases the token count.

Source

fn increase_recursion(&mut self)

Increases the recursion depth.

Source

fn decrease_recursion(&mut self)

Decreases the recursion depth.

Source

fn check(&self) -> Result<(), Self::Error>

Checks if any of the limits have been exceeded.

Provided Methods§

Source

fn increase_token_and_decrease_recursion(&mut self)

Increase the token count and decrease recursion depth.

Source

fn increase_token_and_decrease_recursion_and_check( &mut self, ) -> Result<(), Self::Error>

Increases the token count and decreases recursion depth and checks limits.

Source

fn increase_token_and_check(&mut self) -> Result<(), Self::Error>

Increases the token count and checks limits.

Source

fn increase_both(&mut self)

Increases the token count and recursion depth, then checks limits.

Source

fn increase_both_and_check(&mut self) -> Result<(), Self::Error>

Increase the token count, decrease recursion depth, then checks limits.

Implementations on Foreign Types§

Source§

impl<'a, T> Tracker for Lexer<'a, T>
where T: Logos<'a>, T::Extras: Tracker,

Available on crate feature logos only.

Implementors§

Source§

impl Tracker for Limiter

Source§

impl<'a, T, L> Tracker for LogosLexer<'a, T, L>
where T: From<L> + Token<'a>, L: Logos<'a>, L::Extras: Tracker,

Available on crate feature logos only.
Source§

type Error = <<L as Logos<'a>>::Extras as Tracker>::Error