Move enum data when only have mutable reference

Got it. But the question remains whether my code can panic at all during these two lines? I think it can't panic caused by these two lines, right? But perhaps from some external factor?

Assuming State::VoteResultsPublished is an enum variant and not a user-defined function, I agree these two lines cannot panic.

1 Like

Apparently stack overflow always aborts, so even that isn't a problem.

And what about other threads or an async environment?

Thread A can’t run code (including panicking code) on thread B. At worst it can abort the program, causing all threads to simply halt.

Async code can only be interrupted at await points. And if this isn’t in an async block or fn, then even that is not an issue.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.