Starts synchronous block interface

This commit is contained in:
2026-03-19 15:28:31 +01:00
parent f727c119b8
commit 2baee8d28b
11 changed files with 348 additions and 260 deletions

View File

@ -1,4 +1,7 @@
use crate::edge::{AnonymousStreamConsumer, AnonymousStreamProducer, BlockIOIndex};
use crate::{
edge::BlockIOIndex,
io::{AnonymousStreamConsumer, AnonymousStreamProducer},
};
pub enum BlockResult
{
@ -46,13 +49,18 @@ pub trait Block
fn work(&mut self) -> BlockResult;
}
pub trait SyncBlock
// Represents the input, output, state types
// that a SyncBlock will have to interacti with
pub trait SyncBlockIO
{
type StateView;
type Input;
type Output;
type State;
}
fn sync_work(state: &mut Self::State, input: Self::Input) -> Option<Self::Output>;
pub trait SyncBlock: SyncBlockIO
{
fn sync_work(state: Self::StateView, input: Self::Input) -> Option<Self::Output>;
}
pub trait GraphableBlock: Block + BlockIO {}