esvc_traits/
lib.rs

1#![no_std]
2#![forbid(unsafe_code)]
3
4use core::{cmp::PartialEq, fmt::Debug};
5
6pub trait EngineError: Sized + Sync + Send + 'static {}
7impl<T: Sync + Send + 'static> EngineError for T {}
8
9pub trait CommandArg: Sized + Debug + Sync + PartialEq + serde::Serialize {}
10impl<T: Debug + Sync + PartialEq + serde::Serialize> CommandArg for T {}
11
12pub trait FlowData: Sized + Clone + Debug + Sync + Send + PartialEq {}
13impl<T: Clone + Debug + Sync + Send + PartialEq> FlowData for T {}
14
15pub trait Engine: Sync {
16    type Error: EngineError;
17    type Arg: CommandArg;
18    type Dat: FlowData;
19
20    /// execute an event of a given data `dat`, ignoring dependencies.
21    /// returns `Err` if execution failed, and everything already lookup'ed
22    fn run_event_bare(
23        &self,
24        cmd: u32,
25        arg: &Self::Arg,
26        dat: &Self::Dat,
27    ) -> Result<Self::Dat, Self::Error>;
28}