fsmy 0.1.0

A finite state machine library
use std::marker::PhantomData;

use derive_builder::Builder;
use derive_getters::Getters;

use crate::prelude::*;

/// And edge is a path taking from a state to another given an input message.
/// An edge can optionally have a mutation function registered, which will run
/// when the state changes and can mutate the machine context.
#[derive(Debug, Clone, Getters, Builder)]
#[builder(pattern = "owned")]
pub struct Edge<'a, S, I, O, C> {
    #[builder(default = PhantomData)]
    marker: PhantomData<&'a fn(&mut C)>,
    source_state: S,
    target_state: S,
    message: I,
    output: Option<O>,
    mutation: Option<Mutation<'a, C>>,
}