Skip to main content

ProgramExecutor

Trait ProgramExecutor 

Source
pub trait ProgramExecutor {
    // Required methods
    fn new(
        stack_inputs: StackInputs,
        advice_inputs: AdviceInputs,
        options: ExecutionOptions,
    ) -> Result<Self, AdviceError>
       where Self: Sized;
    fn with_debug_info(self, package_debug_info: PackageDebugInfo) -> Self;
    fn with_entrypoint_source_node(
        self,
        entrypoint_source_node: Option<DebugSourceNodeId>,
    ) -> Self;
    fn execute<H: Host + Send>(
        self,
        program: &Program,
        host: &mut H,
    ) -> impl FutureMaybeSend<Result<ExecutionOutput, ExecutionError>>;
}
Expand description

A pluggable program executor used to run a Program against a Host.

Defaults to FastProcessor. Alternative implementations can wrap execution in a debugger, add instrumentation, or redirect to a different backend, while leaving the surrounding executor wiring untouched.

Required Methods§

Source

fn new( stack_inputs: StackInputs, advice_inputs: AdviceInputs, options: ExecutionOptions, ) -> Result<Self, AdviceError>
where Self: Sized,

Creates a new executor configured with the provided inputs and options.

In generic code (E: ProgramExecutor) this resolves normally. For the concrete FastProcessor type, however, the inherent FastProcessor::new (which takes only stack inputs) shadows this trait method by name, so invoke the trait constructor with fully-qualified syntax: <FastProcessor as ProgramExecutor>::new(stack_inputs, advice_inputs, options).

Source

fn with_debug_info(self, package_debug_info: PackageDebugInfo) -> Self

Configures package-owned source and debug information for execution.

Source

fn with_entrypoint_source_node( self, entrypoint_source_node: Option<DebugSourceNodeId>, ) -> Self

Configures the source node at which execution begins.

Source

fn execute<H: Host + Send>( self, program: &Program, host: &mut H, ) -> impl FutureMaybeSend<Result<ExecutionOutput, ExecutionError>>

Executes the provided program against the given host.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§