2026-11-03 16:01:24 +00:00
|
|
|
pub fn handle(ctx, state, sender, message) {
|
2026-11-03 18:23:43 +00:00
|
|
|
let state = match state { () => 0, state => state };
|
|
|
|
|
if message.op == "inc" {
|
|
|
|
|
let new_state = state + 1;
|
|
|
|
|
ctx.info(`New State: ${new_state}`);
|
|
|
|
|
ctx.send(ctx.this, #{op: "inc"});
|
|
|
|
|
new_state
|
2026-11-02 08:19:04 +00:00
|
|
|
} else {
|
feat!: add structured actor state and messages
Introduce owned portable values with distinct actor references, bounded Rune conversion, JSON REPL literals, and nested reference completion. Preserve isolation and atomic transitions across state, messages, effects, migration, inspection, and TCP clients.
BREAKING CHANGE: protocol v3 replaces integer state and kind/value/target_ref messages with tagged values. Rune handlers now take (state, message) and return (new_state, [(actor_reference, message)]). The REPL send command accepts one JSON message.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-02 15:56:03 +00:00
|
|
|
panic("unknown counter operation")
|
2026-11-02 08:19:04 +00:00
|
|
|
}
|
|
|
|
|
}
|