mod events;
mod fsm_impl;
mod fsm_factory;
mod queue;
mod states;
mod transitions;
mod tests_fsm;
mod dispatch;
mod timers;
mod inspect;
pub use self::events::*;
pub use self::fsm_factory::*;
pub use self::fsm_impl::*;
pub use self::queue::*;
pub use self::states::*;
pub use self::transitions::*;
pub use self::inspect::*;
pub use self::dispatch::*;
pub use self::timers::*;
use crate::lib::*;
pub type FsmResult<T> = Result<T, FsmError>;
#[derive(Debug, PartialEq)]
pub enum FsmError {
NoTransition,
QueueOverCapacity,
NotSupported,
TimerNotStarted
}
pub type FsmDispatchResult = FsmResult<()>;
pub trait FsmBackend where Self: Sized + Debug {
type Context;
type States: FsmStates<Self>;
type Events: AsRef<str> + Clone;
type Timers: Debug + Clone + PartialEq + AllVariants;
fn dispatch_event<Q, I, T>(ctx: DispatchContext<Self, Q, I, T>, event: FsmEvent<Self::Events, Self::Timers>) -> FsmDispatchResult
where Q: FsmEventQueue<Self>, I: Inspect, T: FsmTimers<Self>;
}
pub trait AllVariants where Self: Sized
{
type Iter: Iterator<Item=Self>;
fn iter() -> Self::Iter;
}