Invoker

Trait Invoker 

Source
pub trait Invoker<H> {
    type State;
    type Interpreter: Interpreter<H, State = Self::State>;
    type Interrupt;
    type TransactArgs;
    type TransactInvoke;
    type TransactValue;
    type SubstackInvoke;

    // Required methods
    fn new_transact(
        &self,
        args: Self::TransactArgs,
        handler: &mut H,
    ) -> Result<(Self::TransactInvoke, InvokerControl<Self::Interpreter, Self::State>), ExitError>;
    fn finalize_transact(
        &self,
        invoke: &Self::TransactInvoke,
        exit: InvokerExit<Self::State>,
        handler: &mut H,
    ) -> Result<Self::TransactValue, ExitError>;
    fn enter_substack(
        &self,
        trap: <Self::Interpreter as Interpreter<H>>::Trap,
        machine: &mut Self::Interpreter,
        handler: &mut H,
        depth: usize,
    ) -> Capture<Result<(Self::SubstackInvoke, InvokerControl<Self::Interpreter, Self::State>), ExitError>, Self::Interrupt>;
    fn exit_substack(
        &self,
        trap_data: Self::SubstackInvoke,
        exit: InvokerExit<Self::State>,
        parent: &mut Self::Interpreter,
        handler: &mut H,
    ) -> Result<(), ExitError>;
}
Expand description

An invoker, responsible for pushing/poping values in the call stack.

Required Associated Types§

Source

type State

State type.

Source

type Interpreter: Interpreter<H, State = Self::State>

Interpreter type.

Source

type Interrupt

Possible interrupt type that may be returned by the call stack.

Source

type TransactArgs

Type for transaction arguments.

Source

type TransactInvoke

The invoke of a top-layer transaction call stack. When finalizing a transaction, this invoke is used to figure out the finalization routine.

Source

type TransactValue

The returned value of the transaction.

Source

type SubstackInvoke

The invoke of a sub-layer call stack. When exiting a call stack, this invoke is used to figure out the exit routine.

Required Methods§

Source

fn new_transact( &self, args: Self::TransactArgs, handler: &mut H, ) -> Result<(Self::TransactInvoke, InvokerControl<Self::Interpreter, Self::State>), ExitError>

Create a new transaction with the given transaction arguments.

Source

fn finalize_transact( &self, invoke: &Self::TransactInvoke, exit: InvokerExit<Self::State>, handler: &mut H, ) -> Result<Self::TransactValue, ExitError>

Finalize a transaction.

Source

fn enter_substack( &self, trap: <Self::Interpreter as Interpreter<H>>::Trap, machine: &mut Self::Interpreter, handler: &mut H, depth: usize, ) -> Capture<Result<(Self::SubstackInvoke, InvokerControl<Self::Interpreter, Self::State>), ExitError>, Self::Interrupt>

Enter a sub-layer call stack.

Source

fn exit_substack( &self, trap_data: Self::SubstackInvoke, exit: InvokerExit<Self::State>, parent: &mut Self::Interpreter, handler: &mut H, ) -> Result<(), ExitError>

Exit a sub-layer call stack.

Implementors§