Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new function to perform transition using message enum as input #17

Open
johanmazel opened this issue Apr 26, 2019 · 2 comments
Open

Comments

@johanmazel
Copy link

johanmazel commented Apr 26, 2019

It would be nice to extend the enum module that contains states and add an additional function to execute transitions using the message enum, instead of executing transition by using message specific function.
This function would be similar to the execute function in the crate macro_machine or the handle_event function in macro_machines.

For the example provided in the doc, in the module Traffic, this new function would be something like:

fn execute(t: &Traffic, m: &TrafficMessages) -> Traffic {
    match m {
        TrafficMessages::Advance(advance) => t.on_advance(advance),
        TrafficMessages::PassCar(pass_car) => t.on_pass_car(pass_car),
    }
}
@Geal
Copy link
Collaborator

Geal commented Jun 14, 2019

hello, this is now done in a13cc18, it will be available in the 0.3 version

@johanmazel
Copy link
Author

Thank you very much. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants