Module nu_protocol::debugger::debugger_trait

source ·
Expand description

Traits related to debugging

The purpose of DebugContext is achieving static dispatch on eval_xxx() calls. The main Debugger trait is intended to be used as a trait object.

The debugging information is stored in EngineState as the debugger field storing a Debugger trait object behind Arc and Mutex. To evaluate something (e.g., a block), first create a Debugger trait object (such as the Profiler). Then, add it to engine state via engine_state.activate_debugger(). This sets the internal state of EngineState to the debugging mode and calls Debugger::activate(). Now, you can call eval_xxx::<WithDebug>(). When you’re done, call engine_state.deactivate_debugger() which calls Debugger::deactivate(), sets the EngineState into non-debugging mode, and returns the original mutated Debugger trait object. (NoopDebugger is placed in its place inside EngineState.) After deactivating, you can call Debugger::report() to get some output from the debugger, if necessary.

Structs§

  • A debugger that does nothing
  • Marker struct signalizing that evaluation should use a Debugger
  • Marker struct signalizing that evaluation should NOT use a Debugger

Traits§

  • Trait used for static dispatch of eval_xxx() evaluator calls
  • Debugger trait that every debugger needs to implement.