pub struct ActorCell {
pub state: Value,
pub handler: ActorHandler,
}Expand description
Internal state of a conc.Actor. Protected by a Mutex so that
the Lex handler variant serialises on message delivery (one
message processed at a time, state mutated under the lock). The
handler is dispatched on the calling VM’s thread — no extra
OS thread required — which lets Lex handlers invoke arbitrary
effects (sql, net, …) through the same handler chain.
Serialisation note: the Native variant releases the mutex
before invoking its closure (state is unused for natives —
the “state” is an external resource like a channel), so two
concurrent conc.tells on the same native bridge may invoke
the closure on overlapping threads. Native bridges therefore
need to be internally thread-safe; the serve_ws_fn_actor
mpsc::Sender bridge is, because Sender::send is.
Fields§
§state: Value§handler: ActorHandler