Are Rust coroutines serializable?

90 points SuperV1234 53 comments

I finished writing an article today on how C++20 coroutines are unsuitable for gamedev.

One of the main issues I have with them, apart from the unavoidable heap allocation, is that the state of the coroutine is completely opaque.

If I want to use coroutines to define game logic, I won't be able to serialize/deserialize the state of a coroutine to support quicksave/quickload, network sync, and save states/introspection for debugging and prototyping.

What is the current situation with Rust coroutines? Is there a way to portably serialize their state/progress?

If not, was this issue raised before?