1 import Base 2 import ./clock_state.bend as Clock 3 import ./deferred_command.bend as Deferred 4 import entity_allocator.bend as Alloc 5 import ./world.bend as W 6 import ./owner_product.bend as Product 7 # Canonical owner split, used only behind ordinary declaration providers. 8 type Rest is Type: 9 Rest{namespace:U32,allocator:Alloc.Allocator,store:C,events:List<&2,E>,pending:List>>,registrations:List<&2,W.RegistrationMeta>,nextSystemId:U32,clock:Clock.State} 10 def take(~S:Data,~C:Type,~R:Type,~E:Data,world:W.World) -> Rest & R: 11 match world: 12 case W.World{ns,allocator,store,resource,events,pending,regs,sid,clock}:(Rest{ns,allocator,store,events,pending,regs,sid,clock},resource) 13 def put(~S:Data,~C:Type,~R:Type,~E:Data,rest:Rest,resource:R) -> W.World: 14 match rest: 15 case Rest{ns,allocator,store,events,pending,regs,sid,clock}:W.World{ns,allocator,store,resource,events,pending,regs,sid,clock} 16 def lens(~S:Data,~C:Type,~R:Type,~E:Data) -> Product.Lens,R,Rest>: 17 Product.Lens{take(~S,~C,~R,~E),put(~S,~C,~R,~E)}