Trait protoflow_core::Block

source ·
pub trait Block:
    AsBlock
    + BlockDescriptor
    + Send
    + Sync {
    // Required method
    fn execute(&mut self, runtime: &dyn BlockRuntime) -> BlockResult;

    // Provided method
    fn prepare(&mut self, _runtime: &dyn BlockRuntime) -> BlockResult { ... }
}
Expand description

A block is an autonomous unit of computation in a system.

Required Methods§

source

fn execute(&mut self, runtime: &dyn BlockRuntime) -> BlockResult

Executes this block’s computation.

Provided Methods§

source

fn prepare(&mut self, _runtime: &dyn BlockRuntime) -> BlockResult

Prepares this block for execution.

This is called once before the first call to execute. This is where to open ports and allocate resources.

Implementors§