Blocks and flowgraph: added this time

This commit is contained in:
2026-03-11 19:31:37 +01:00
parent 13d060776f
commit 6d99d54f4a
9 changed files with 181 additions and 78 deletions

View File

@ -0,0 +1,28 @@
use crate::edge::BlockIOIndex;
pub enum BlockResult
{
Ok,
Terminated,
}
pub trait BlockIO
{
// Get all of the BlockIOIndices (block index + port) that
// this blocks can send data to.
fn get_successors(&self) -> Vec<BlockIOIndex>;
// Sets the index of the current blocks on the shared edges
fn set_index(&self, block_index: usize);
// Number of input/output ports
fn input_count(&self);
fn output_count(&self);
}
pub trait Block
{
fn work(&mut self) -> BlockResult;
}
pub trait GraphableBlock: Block + BlockIO {}