def undo_valid

bendvy-ecs-core@0.1.0.4 · recoverable_component.bend:47

import bendvy-ecs-core@0.1.0.4/recoverable_component.bend as RecoverableComponent
import Base
import bendvy-ecs-core@0.1.0.4/world.bend as W
import bendvy-ecs-core@0.1.0.4/column.bend as Col

47# Trusted inverse: ordinary grants never alter allocation/live state or inject
48# records. Canonical ensure preserves every cell and covers the saved live id;
49# undo restores its exact stamp and returns the displaced owner with its own
50# pre-undo stamp. World clock and every unrelated owner remain unchanged.
51def undo_valid(~S:Data,~P:Type,~R:Type,~E:Data,record:Record<S,P>,world:W.World<S,Col.Column<S,P>,R,E>) -> W.World<S,Col.Column<S,P>,R,E> & Record<S,P>:
52  match record world:
53    case Record{handle,stamp,payload},W.World{ns,allocator,column,resource,events,pending,regs,sid,clock}:
54      undone(~S,~P,~R,~E,ns,allocator,resource,events,pending,regs,sid,clock,undo_column(~S,~P,handle,stamp,payload,column))

Uses (6)

Used by (1)