def stage_command

bendvy-ecs-core@0.1.0.4 · transaction.bend:38

import bendvy-ecs-core@0.1.0.4/transaction.bend as Transaction
import Base
import bendvy-ecs-core@0.1.0.4/deferred_command.bend as Deferred

38# Commands and events are accumulated in reverse and reversed once at commit.
39# Stage an owned deferred command without executing it. Commit enqueues
40# commands in authored order; failure discards them. Visibility follows the
41# command queue's explicit barrier, not transaction completion itself.
42def stage_command(~W:Type,~E:Data,tx:Tx<W,E>,command:Deferred.Command<W>) -> Tx<W,E>:
43  match tx:
44    case Tx{world,undo,commands,events,trace}:Tx{world,undo,command <> commands,events,trace}

Uses (3)

Used by (2)