def count_store

bendvy-ecs-core@0.1.0.4 · ordinary_lifetime_scope.bend:29

import bendvy-ecs-core@0.1.0.4/ordinary_lifetime_scope.bend as OrdinaryLifetimeScope
import Base
import bendvy-ecs-core@0.1.0.4/lifetime_scope.bend as Sc
import bendvy-ecs-core@0.1.0.4/world.bend as W
import bendvy-ecs-core@0.1.0.4/relation_commands.bend as A

29# Trusted provisioning adapter: run the original component counter through the
30# scope/relation wrappers. Returns the wrapped store with its membership and
31# graph owners threaded back; counting does not assign scopes or delete entities.
32def count_store(~S:Data,~C:Type,~count:C -> List<&2,W.Handle<S>> -> C & List<&2,Maybe<&2,U32>>,store:A.Store<S,Sc.Store<S,C>>,handles:List<&2,W.Handle<S>>) -> A.Store<S,Sc.Store<S,C>> & List<&2,Maybe<&2,U32>>:
33  match store:
34    case A.Store{Sc.Store{components,members},graph}:counted(~S,~C,members,graph,count(components,handles))

Uses (8)

Used by (3)