pub struct Matcher { /* private fields */ }Expand description
A position inside a CompiledArtifact. Owns the position, shares the artifact by Arc.
Implementations§
Source§impl Matcher
impl Matcher
Sourcepub fn new(artifact: Arc<CompiledArtifact>) -> Self
pub fn new(artifact: Arc<CompiledArtifact>) -> Self
Starts a matcher at the artifact’s anchored start state.
Sourcepub fn bytes_seen(&self) -> u64
pub fn bytes_seen(&self) -> u64
The number of bytes consumed so far.
Sourcepub fn artifact(&self) -> &Arc<CompiledArtifact> ⓘ
pub fn artifact(&self) -> &Arc<CompiledArtifact> ⓘ
The shared artifact.
Sourcepub fn advance(&mut self, token: TokenId) -> Result<(), MatcherError>
pub fn advance(&mut self, token: TokenId) -> Result<(), MatcherError>
Consumes token, advancing the position. Fails with IllegalToken if the id is unknown or
no path exists (a DEAD matcher rejects every token forever; the position never moves on
Sourcepub fn is_accepting(&self) -> bool
pub fn is_accepting(&self) -> bool
Stopping now yields a complete, valid instance.
Sourcepub fn can_continue(&self) -> bool
pub fn can_continue(&self) -> bool
Some token can still extend this position.
Sourcepub fn allowed_mask(&self) -> Result<Bitmask, CompileError>
pub fn allowed_mask(&self) -> Result<Bitmask, CompileError>
The allowed ordinary-token mask at the current position.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Matcher
impl RefUnwindSafe for Matcher
impl Send for Matcher
impl Sync for Matcher
impl Unpin for Matcher
impl UnsafeUnpin for Matcher
impl UnwindSafe for Matcher
Blanket Implementations§
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