Trait EventHandler

Source
pub trait EventHandler:
    Send
    + Sync
    + 'static {
    // Required method
    fn on_event(
        &self,
        process: &ProcessState<'_>,
    ) -> Result<Vec<AdviceMutation>, EventError>;
}
Expand description

An EventHandler defines a function that that can be called from the processor which can read the VM state and modify the state of the advice provider.

A struct implementing this trait can access its own state, but any output it produces must be stored in the process’s advice provider.

Required Methods§

Source

fn on_event( &self, process: &ProcessState<'_>, ) -> Result<Vec<AdviceMutation>, EventError>

Handles the event when triggered.

Implementors§

Source§

impl<F> EventHandler for F
where F: for<'a> Fn(&'a ProcessState<'_>) -> Result<Vec<AdviceMutation>, EventError> + Send + Sync + 'static,

Default implementation for both free functions and closures with signature fn(&ProcessState) -> Result<(), HandlerError>