diff --git a/finito-core/src/lib.rs b/finito-core/src/lib.rs index 0dda30ae9..517bfad2b 100644 --- a/finito-core/src/lib.rs +++ b/finito-core/src/lib.rs @@ -166,7 +166,7 @@ pub trait FSM where Self: Sized { /// `act` interprets and executes FSM actions. This is the only /// part of an FSM in which side-effects are allowed. - fn act(Self::Action, Self::State) -> Result, Self::Error>; + fn act(Self::Action, &Self::State) -> Result, Self::Error>; } /// This function is the primary function used to advance a state @@ -208,7 +208,7 @@ pub fn advance(state: S, event: S::Event) -> (S, Vec) { /// state type which can be used to track application state that must /// be made available to action handlers, for example to pass along /// database connections. -pub trait FSMBackend { +pub trait FSMBackend { /// Key type used to identify individual state machines in this /// backend. /// @@ -235,9 +235,9 @@ pub trait FSMBackend { /// **Note**: Whether actions are automatically executed depends /// on the backend used. Please consult the backend's /// documentation for details. - fn advance(&self, key: Self::Key, event: F::Event) -> Result + fn advance<'a, F: FSM>(&'a self, key: Self::Key, event: F::Event) -> Result where F: FSM + Serialize + DeserializeOwned, - F::State: From, + F::State: From<&'a S>, F::Event: Serialize + DeserializeOwned, F::Action: Serialize + DeserializeOwned; }