Trait Block

Source
pub trait Block:
    AsBlock
    + BlockDescriptor
    + BlockHooks
    + 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.

Trait Implementations§

Source§

impl Debug for dyn Block

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§