typestate-rs icon indicating copy to clipboard operation
typestate-rs copied to clipboard

[Feature Request] Support for Result<T, E> for direct bifurcation

Open Dessix opened this issue 2 years ago • 0 comments

Custom enums for every non-det state are somewhat limited in that they add a lot of boilerplate if someone wants to make a conversion to Result; with a lack of FromResidual and Try implementations for each non-det enum, they don't have the same expressiveness for monadic chaining.

I'd like to request either of a way to automatically derive Try and FromResidual implementations for non-det output types, or for Result<T, E> to just work if T and E are both states declared in this machine.

The current interpretation of Result<State, AnotherState> is treated by the validator and graph generation as being "final" states.

Dessix avatar Jul 08 '22 23:07 Dessix