Struct SimpleInterStateConnection

Source
pub struct SimpleInterStateConnection<'a, K, Id, D, E>
where Id: Copy + 'a, K: 'a, D: 'a, E: 'a,
{ /* private fields */ }
Expand description

Connection representing edge between two nodes (or one node with itself) in a graph structure. Matcher is used to find the next state. Based on the key provided by the data. Each connection has a specified function which will be executed while changing to matched next state.

  • matcher - Defines whether this connection should be chosen for a specified key. It’s up to the user to ensure that connections don’t have intersecting matchers. The first connection matched for a key will always be used.
  • exec_function - Operation that will be executing while changing state.
  • connected_state - State that will be returned if this connection is matched. Can be the same state that this connection will be assigned to.

Implementations§

Source§

impl<'a, K, Id, D, E> SimpleInterStateConnection<'a, K, Id, D, E>
where Id: Copy,

Source

pub fn new<M: Fn(&K) -> bool + 'a, FExec: Fn(&mut D, &K) -> Result<(), E> + 'a, S: AutomatonState<'a, Id, D, E> + 'a>( matcher: M, exec_function: FExec, next_state: &Rc<RefCell<S>>, ) -> Self

Creates new connection with specified matcher and a procedure that will be executed when this connection is matched.

Source

pub fn new_no_action<M: Fn(&K) -> bool + 'a, S: AutomatonState<'a, Id, D, E> + 'a>( matcher: M, next_state: &Rc<RefCell<S>>, ) -> Self

Creates new connection with specified matcher. Does nothing when matched (designed to be used with intermediate states).

Auto Trait Implementations§

§

impl<'a, K, Id, D, E> Freeze for SimpleInterStateConnection<'a, K, Id, D, E>

§

impl<'a, K, Id, D, E> !RefUnwindSafe for SimpleInterStateConnection<'a, K, Id, D, E>

§

impl<'a, K, Id, D, E> !Send for SimpleInterStateConnection<'a, K, Id, D, E>

§

impl<'a, K, Id, D, E> !Sync for SimpleInterStateConnection<'a, K, Id, D, E>

§

impl<'a, K, Id, D, E> Unpin for SimpleInterStateConnection<'a, K, Id, D, E>

§

impl<'a, K, Id, D, E> !UnwindSafe for SimpleInterStateConnection<'a, K, Id, D, E>

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.