pub struct GrammarStateMachine { /* private fields */ }Expand description
The grammar state machine. Tracks the current parse position and a stack of nested contexts (blocks, parens, triples, etc.) for proper nesting.
Implementations§
Source§impl GrammarStateMachine
impl GrammarStateMachine
Sourcepub fn feed_byte(&mut self, b: u8)
pub fn feed_byte(&mut self, b: u8)
Feed a decoded byte into the state machine, updating the state.
Sourcepub fn feed_token(&mut self, bytes: &[u8])
pub fn feed_token(&mut self, bytes: &[u8])
Feed a decoded token’s bytes.
Sourcepub fn state(&self) -> GrammarState
pub fn state(&self) -> GrammarState
Get the current grammar state.
Sourcepub fn byte_allowed(&self, b: u8, _depth: usize) -> bool
pub fn byte_allowed(&self, b: u8, _depth: usize) -> bool
Determine if a byte is allowed at the current grammar position. This is the predicate used by the trie walker.
Trait Implementations§
Source§impl Clone for GrammarStateMachine
impl Clone for GrammarStateMachine
Auto Trait Implementations§
impl Freeze for GrammarStateMachine
impl RefUnwindSafe for GrammarStateMachine
impl Send for GrammarStateMachine
impl Sync for GrammarStateMachine
impl Unpin for GrammarStateMachine
impl UnsafeUnpin for GrammarStateMachine
impl UnwindSafe for GrammarStateMachine
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.