def replace

bendvy-ecs-core@0.1.0.4 · ordinary_recovery_capture.bend:20

import bendvy-ecs-core@0.1.0.4/ordinary_recovery_capture.bend as OrdinaryRecoveryCapture
import Base
import bendvy-ecs-core@0.1.0.4/world.bend as W
import bendvy-ecs-core@0.1.0.4/owner_product.bend as Product
import bendvy-ecs-core@0.1.0.4/ordinary_recoverable_array_resource.bend as F
import bendvy-ecs-core@0.1.0.4/recoverable_array.bend as A
import bendvy-ecs-core@0.1.0.4/recoverable_array_owner.bend as AO

20# Replace retained Array<Q> capture, recording its displaced owner in the
21# shared recovery journal. Commit returns the displaced array; rollback
22# restores it and returns the replacement through the recovery accumulator.
23# World remains the retained sibling of capture.
24def replace(~S:Data,~C:Type,~R:Type,~E:Data,~Q:Type,~All:Type,~Rest:Type,~path:Product.Lens<All,List<A.Record<Q>>,Rest>,frame:F.Frame<Product.Owner<W.World<S,C,R,E>,Array<Q>>,All>,incoming:Array<Q>) -> F.Frame<Product.Owner<W.World<S,C,R,E>,Array<Q>>,All>:
25  match frame:
26    case F.Frame{state,journal}:replaced(~S,~C,~R,~E,~Q,~All,~Rest,~path,AO.replace(~Product.Owner<W.World<S,C,R,E>,Array<Q>>,~Q,~W.World<S,C,R,E>,~Product.lens(~W.World<S,C,R,E>,~Array<Q>,~Product.Right{}),~All,~Rest,~path,state,journal,incoming))

Uses (11)

Used by (1)