Starts synchronous block interface
This commit is contained in:
@ -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 {}
|
||||
|
||||
Reference in New Issue
Block a user