2 ms·
The mutable state isn't explicit here (it's internal mutability), but it's the TcpStream. In an actor system the TcpStream would be local to an actor. You'd sa
by staticassertion 5y ago
The mutable state isn't explicit here (it's internal mutability), but it's the TcpStream.
In an actor system the TcpStream would be local to an actor. You'd say "parse_line" by sending it a message. That message would be processed to-completion before another message could be processed - even if there is yielding internally.
You could also wrap TcpStream with some sort of wrapper that doesn't expose its internal mutability - that would let the type system ensure there isn't shared mutability across tasks I think...