pub struct Constraints<T: FsmTypes> {
pub preconditions: HashMap<&'static str, Vec<(Pred<T>, String)>>,
pub invariants: Vec<(Pred<T>, String)>,
pub transitions: HashMap<(&'static str, &'static str), TransitionCheck<T>>,
}Fields§
§preconditions: HashMap<&'static str, Vec<(Pred<T>, String)>>§invariants: Vec<(Pred<T>, String)>§transitions: HashMap<(&'static str, &'static str), TransitionCheck<T>>Implementations§
Source§impl<T: FsmTypes> Constraints<T>
impl<T: FsmTypes> Constraints<T>
pub fn new() -> Constraints<T>
pub fn check_preconditions( &self, state: &'static str, ctx: &T::Context, ) -> Result<(), String>
pub fn check_invariants(&self, ctx: &T::Context) -> Result<(), String>
Sourcepub fn check_transition(
&self,
from: &'static str,
to: &'static str,
init_ctx: &T::Context,
final_ctx: &T::Context,
msg: &T::Msg,
output: &Vec<T::Output>,
) -> Result<(), String>
pub fn check_transition( &self, from: &'static str, to: &'static str, init_ctx: &T::Context, final_ctx: &T::Context, msg: &T::Msg, output: &Vec<T::Output>, ) -> Result<(), String>
Verify a transition result
from is the from state,
to is the to state,
init_ctx is the internal data state of the fsm before the transition
final_ctx is the internal data state of the fsm after the transition
msg is the message that caused the transition
output is the output messages as a result of the transition
Returns an error string if the transition check fails
Auto Trait Implementations§
impl<T> Freeze for Constraints<T>
impl<T> !RefUnwindSafe for Constraints<T>
impl<T> !Send for Constraints<T>
impl<T> !Sync for Constraints<T>
impl<T> Unpin for Constraints<T>
impl<T> !UnwindSafe for Constraints<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more