Struct Constraints

Source
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>

Source

pub fn new() -> Constraints<T>

Source

pub fn check_preconditions( &self, state: &'static str, ctx: &T::Context, ) -> Result<(), String>

Source

pub fn check_invariants(&self, ctx: &T::Context) -> Result<(), String>

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.