def checked

bendvy-ecs-core@0.1.0.3 · execution_relation_resource_publication.bend:23

import bendvy-ecs-core@0.1.0.3/execution_relation_resource_publication.bend as ExecutionRelationResourcePublication
import Base
import bendvy-ecs-core@0.1.0.3/execution_composer_layout.bend as Layout
import bendvy-ecs-core@0.1.0.3/execution_relation_store.bend as Store
import bendvy-ecs-core@0.1.0.3/execution_relation_operation.bend as O
import bendvy-ecs-core@0.1.0.3/relation_types.bend as T
import bendvy-ecs-core@0.1.0.3/entity_allocator.bend as Allocator
import bendvy-ecs-core@0.1.0.3/change_tick.bend as Tick

23def checked(~S:Data,~WR:Type,~resources:Layout.Layout,~same:{WR == Layout.resources(~S,resources) : Type},~route:Layout.Route,~valid:{Layout.grant_valid(~resources,~route) == True{} : Bool},~descriptor:T.Descriptor<S>,~payload:{Layout.payload(resources,route) == Store.Store<S,descriptor> : Type},~view:{Layout.view(resources,route) == Store.View<S,descriptor> : Data},allowed:Bool,namespace:U32,allocator:Allocator.Allocator,owners:WR,operation:O.Operation<S>,tick:Tick.Tick) -> Allocator.Allocator & (WR & Store.Receipt<S>):
24  match allowed:
25    case False{}:(allocator,(owners,Store.Refused{operation,Store.NamespaceMismatch{}}))
26    case True{}:taken(~S,~WR,~resources,~same,~route,~descriptor,~payload,~view,namespace,allocator,operation,tick,Layout.resource_take(~S,resources,route,Layout.checked_owner(WR,Layout.resources(~S,resources),same,owners)))

Uses (21)

Used by (1)