Skip to content

Is there a use case (or consequences) for defining the ractor::Actor struct with state? #271

Answered by slawlor
stuartcarnie asked this question in Q&A
Discussion options

You must be logged in to vote

Nope it's fine to do technically and has no impact but it does mean you need to construct that immutable state outside of the actor spawning flow which does introduce a panic risk to the parent actor. Since it won't be managed for you.

It's the motivation for why the state is a separate struct, which I think there's a note on the main readme. But for simple things with no risk, it's completely fine as long as you don't need mutability

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by stuartcarnie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants