nu_protocol::debugger::debugger_trait

Trait DebugContext

Source
pub trait DebugContext:
    Clone
    + Copy
    + Debug {
    // Provided methods
    fn enter_block(engine_state: &EngineState, block: &Block) { ... }
    fn leave_block(engine_state: &EngineState, block: &Block) { ... }
    fn enter_element(engine_state: &EngineState, element: &PipelineElement) { ... }
    fn leave_element(
        engine_state: &EngineState,
        element: &PipelineElement,
        result: &Result<PipelineData, ShellError>,
    ) { ... }
    fn enter_instruction(
        engine_state: &EngineState,
        ir_block: &IrBlock,
        instruction_index: usize,
        registers: &[PipelineData],
    ) { ... }
    fn leave_instruction(
        engine_state: &EngineState,
        ir_block: &IrBlock,
        instruction_index: usize,
        registers: &[PipelineData],
        error: Option<&ShellError>,
    ) { ... }
}
Expand description

Trait used for static dispatch of eval_xxx() evaluator calls

DebugContext implements the same interface as Debugger (except activate() and deactivate(). It is intended to be implemented only by two structs

  • WithDebug which calls down to the Debugger methods
  • WithoutDebug with default implementation, i.e., empty calls to be optimized away

Provided Methods§

Source

fn enter_block(engine_state: &EngineState, block: &Block)

Called when the evaluator enters a block

Source

fn leave_block(engine_state: &EngineState, block: &Block)

Called when the evaluator leaves a block

Source

fn enter_element(engine_state: &EngineState, element: &PipelineElement)

Called when the AST evaluator enters a pipeline element

Source

fn leave_element( engine_state: &EngineState, element: &PipelineElement, result: &Result<PipelineData, ShellError>, )

Called when the AST evaluator leaves a pipeline element

Source

fn enter_instruction( engine_state: &EngineState, ir_block: &IrBlock, instruction_index: usize, registers: &[PipelineData], )

Called before the IR evaluator runs an instruction

Source

fn leave_instruction( engine_state: &EngineState, ir_block: &IrBlock, instruction_index: usize, registers: &[PipelineData], error: Option<&ShellError>, )

Called after the IR evaluator runs an instruction

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§