def dispose

bendvy-ecs-core@0.1.0.4 · local.bend:130

import bendvy-ecs-core@0.1.0.4/local.bend as Local
import Base
import bendvy-ecs-core@0.1.0.4/world.bend as W
import bendvy-ecs-core@0.1.0.4/registration.bend as Reg

130# Remove the matching live registration, then consume L once with the
131# explicit disposeLocal callback and return its output. Refusal retains
132# instance/World without calling disposeLocal. Arbitrary callback effects
133# are outside ECS rollback; inspect the result instead of assuming disposal.
134def dispose(~S: Data,~C: Type,~R: Type,~E: Data,~L: Type,~Args: Type,~Error: Data,~Out: Type,~runner: W.World<S,C,R,E> -> L -> Args -> Outcome<W.World<S,C,R,E>,L,Error,Out>,~Disposed: Type,~disposeLocal: L -> Disposed,instance: Instance<S,C,R,E,L,Args,Error,Out,runner>,world: W.World<S,C,R,E>) -> Disposal<S,C,R,E,L,Args,Error,Out,runner,Disposed>:
135  match instance:
136    case Instance{+namespace,+id,+name,+access,local}: disposal(~S,~C,~R,~E,~L,~Args,~Error,~Out,~runner,~Disposed,~disposeLocal,Instance{namespace,id,name,access,local},Reg.remove(~S,~C,~R,~E,world,namespace,id,name,access))

Uses (6)

Used by (1)