1use std::fmt::Debug;
2use std::hash::Hash;
3
4use super::{abstr, misc::MachineMisc};
5
6pub trait Input: Debug + PartialEq + Eq + Hash + Clone + Send + Sync {}
7
8impl<T: Debug + PartialEq + Eq + Hash + Clone + Send + Sync> Input for T {}
9
10pub trait Param: Debug + PartialEq + Eq + Hash + Clone + Send + Sync {}
11
12impl<T: Debug + PartialEq + Eq + Hash + Clone + Send + Sync> Param for T {}
13
14pub trait State {}
15
16impl<T: Debug + PartialEq + Eq + Hash + Clone + Send + Sync> State for T {}
17
18pub trait Machine
19where
20 Self: Sized + 'static + Send + Sync,
21{
22 type Input: Input;
26
27 type Param: Param;
31
32 type State: State;
36
37 #[must_use]
41 fn init(&self, input: &Self::Input, param: &Self::Param) -> Self::State;
42
43 #[must_use]
47 fn next(&self, state: &Self::State, input: &Self::Input, param: &Self::Param) -> Self::State;
48}
49
50pub trait Test {
51 fn into_bool(self) -> bool;
52}
53
54pub trait FullMachine: Machine + MachineMisc {
55 type Abstr: abstr::Machine<Self>;
56}
57
58pub trait IntoMck {
59 type Type;
60 #[must_use]
61 fn into_mck(self) -> Self::Type;
62}