I think this makes sense. I’m eager to try it. Some residual questions: what is “untyped” in this case and what is “PostConditional” (an enum of possible states?)? How do subsequent transitions work?
I also just realized that delegating to “UntypedStateMachine” for I/O probably doesn’t allow for Sans-I/O, right? Presumably the UntypedStateMachine must commit to either being sync or async and that must propagate to the typestate state machine itself, no?
Comments
The I/O is done using the mutable reference to the UntypedStateMachine in the functions.
For example UntypedStateMachine could just be a vec that you append to or read from.
If you want to model cases with failure your return type will be
Result<StateMachine<Reserved>, Error>
A conditional transition should return something like
(StateMachine<PostConditional>, ConditionalData)
I think this makes sense. I’m eager to try it. Some residual questions: what is “untyped” in this case and what is “PostConditional” (an enum of possible states?)? How do subsequent transitions work?
I also just realized that delegating to “UntypedStateMachine” for I/O probably doesn’t allow for Sans-I/O, right? Presumably the UntypedStateMachine must commit to either being sync or async and that must propagate to the typestate state machine itself, no?