Skip to main content

TraceHandler

Trait TraceHandler 

Source
pub trait TraceHandler:
    Send
    + Sync
    + 'static {
    // Required method
    fn on_trace(&self, process: &ProcessorState<'_>) -> Result<(), TraceError>;
}
Expand description

Handles an optional, read-only trace event emitted by the VM.

Trace events are emitted by pushing the user trace event ID and then SystemEvent::TraceEvent onto the stack before emit. When the handler runs, SystemEvent::TraceEvent is at stack position 0 and the user trace event ID is at position

  1. The handler receives a read-only ProcessorState and cannot return advice mutations.

Required Methods§

Source

fn on_trace(&self, process: &ProcessorState<'_>) -> Result<(), TraceError>

Handles the trace event when triggered.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F> TraceHandler for F
where F: for<'a> Fn(&'a ProcessorState<'_>) -> Result<(), TraceError> + Send + Sync + 'static,

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