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

Initializing state to a runtime obtained value #25

Closed
mattboardman opened this issue Jun 2, 2024 · 2 comments
Closed

Initializing state to a runtime obtained value #25

mattboardman opened this issue Jun 2, 2024 · 2 comments

Comments

@mattboardman
Copy link

My program writes out the current state to a file on every transition. If the program crashes (or needs to be rerun for any other reason) I want to read from the state and initialize the state machine to whatever value is read from the file.

Something like:

let maybe_cached_state: Option<MyState> = read_state_from_file();

if let Some(my_state) = maybe_cached_state {

    let host_machine = MyStateMachine::default()
          .uninitialized_state_machine()
          .init_override(my_state)
          .await;
}

Is there a way to do this with the library or would this be a feature request?

@cernicc
Copy link

cernicc commented Jun 7, 2024

Hey, statig does implement serde. You could probably enable that and directly save the serialized state machine.

@mdeloof
Copy link
Owner

mdeloof commented Jun 20, 2024

I'm going to assume that solved your issue. If not, feel free to re-open it 🙂

@mdeloof mdeloof closed this as completed Jun 20, 2024
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

3 participants