mistralrs::llguidance::toktrie::recognizer

Trait FunctionalRecognizer

pub trait FunctionalRecognizer<S>
where S: Copy,
{ // Required methods fn initial(&self) -> S; fn try_append(&self, state: S, byte: u8) -> Option<S>; fn special_allowed(&self, state: S, tok: SpecialToken) -> bool; // Provided method fn get_error(&self, _state: S) -> Option<String> { ... } }

Required Methods§

fn initial(&self) -> S

Initial state

fn try_append(&self, state: S, byte: u8) -> Option<S>

Extend the recognizer with given byte if allowed.

fn special_allowed(&self, state: S, tok: SpecialToken) -> bool

Check if given special token is allowed in given state.

Provided Methods§

fn get_error(&self, _state: S) -> Option<String>

Get error message if recognizer is in error state.

Implementors§