def removal_validate_checked

bendvy-ecs-core@0.1.0.4 · ordinary_reader_stream_parameter.bend:359

import bendvy-ecs-core@0.1.0.4/ordinary_reader_stream_parameter.bend as OrdinaryReaderStreamParameter
import Base
import bendvy-ecs-core@0.1.0.4/reader_parameter.bend as RP
import bendvy-ecs-core@0.1.0.4/world.bend as W
import bendvy-ecs-core@0.1.0.4/event_family_routing.bend as Route
import bendvy-ecs-core@0.1.0.4/event_notice_runtime.bend as Mixed
import bendvy-ecs-core@0.1.0.4/relation_commands.bend as Notice
import bendvy-ecs-core@0.1.0.4/ordinary_removal_provision.bend as Provision
import bendvy-ecs-core@0.1.0.4/ordinary_declaration.bend as Identity
import bendvy-ecs-core@0.1.0.4/removals.bend as Rm

359def removal_validate_checked(~S:Data,~C:Type,~R:Type,~P:Data,~Payload:Type,~F:Type,~H:Type,
360  ~inject:Identity.Declaration<S,Payload> -> W.Handle<S> -> Notice.Notice<S,P>,
361  ~select:Notice.Notice<S,P> -> Maybe<&2,Rm.Record<S,Identity.Declaration<S,Payload>>>,
362  ~selection:Provision.Selection<S,Payload,Notice.Notice<S,P>,inject,select>,
363  state:Mixed.State<S,P,F,H>,tick:Nat,facts:RP.RegistrationFacts,
364  reader:Rm.Reader<S,Notice.Notice<S,P>,Identity.Declaration<S,Payload>,select>,
365  registered:W.World<S,C,R,Notice.Notice<S,P>> & Bool) -> Route.Runtime<S,C,R,Notice.Notice<S,P>,Mixed.State<S,P,F,H>> & (RemovalOwner<S,Payload,Notice.Notice<S,P>,select> & Bool):
366  match facts:
367    case RP.RegistrationFacts{+expectedNamespace,+expectedId,_,+access}:
368      match reader:
369        case Rm.Reader{+namespace,+id,+name,cursor}:
370          match registered:
371            case (world,isRegistered):
372              +expected=removal_access(~S,~Payload,~Notice.Notice<S,P>,~inject,~select,selection)
373              +valid=Bool.and(isRegistered,Bool.and(access_subset(expected,access),
374                Bool.and(U32.is_eq(namespace,expectedNamespace),
375                  Bool.and(U32.is_eq(id,expectedId),String.eq(name,removal_name(~S,~Payload,~Notice.Notice<S,P>,~inject,~select,selection))))))
376              (Route.Runtime{world,state,tick},(RemovalOwner{facts,Rm.Reader{namespace,id,name,cursor}},valid))

Uses (22)

Used by (1)