pub struct EventfulContext { /* private fields */ }
Expand description
A recognition context that calls the supplied event handler every time the engine recognizes a phrase in it.
Implementations§
Source§impl EventfulContext
impl EventfulContext
Sourcepub fn new<E: EventHandler + 'static>(
recognizer: &Recognizer,
handler: E,
) -> Result<Self>
pub fn new<E: EventHandler + 'static>( recognizer: &Recognizer, handler: E, ) -> Result<Self>
Creates a new recognition context for the given recognizer, configured to call the given handler whenever a phrase from this context is recognized.
Methods from Deref<Target = Context>§
Sourcepub fn set_enabled(&self, enabled: bool) -> Result<()>
pub fn set_enabled(&self, enabled: bool) -> Result<()>
Enables or disables the recognition of rules from all grammars loaded into this context.
Sourcepub fn grammar_builder(&self) -> GrammarBuilder<'_>
pub fn grammar_builder(&self) -> GrammarBuilder<'_>
Creates a GrammarBuilder
that will construct and load a grammar into this context.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EventfulContext
impl RefUnwindSafe for EventfulContext
impl Send for EventfulContext
impl Sync for EventfulContext
impl Unpin for EventfulContext
impl UnwindSafe for EventfulContext
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