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,
impl<'a, K, Id, D, E> SimpleInterStateConnection<'a, K, Id, D, E>where
Id: Copy,
Sourcepub 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
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.
Sourcepub fn new_no_action<M: Fn(&K) -> bool + 'a, S: AutomatonState<'a, Id, D, E> + 'a>(
matcher: M,
next_state: &Rc<RefCell<S>>,
) -> Self
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> 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