def checked_path

bendvy-ecs-core@0.1.0.4 · hierarchy_traversal_provider.bend:30

import bendvy-ecs-core@0.1.0.4/hierarchy_traversal_provider.bend as HierarchyTraversalProvider
import Base
import bendvy-ecs-core@0.1.0.4/relation_types.bend as G
import bendvy-ecs-core@0.1.0.4/relation_commands.bend as A
import bendvy-ecs-core@0.1.0.4/relation_reorder.bend as Reorder
import bendvy-ecs-core@0.1.0.4/world.bend as W
import bendvy-ecs-core@0.1.0.4/hierarchy_provider.bend as P

30def checked_path(~S:Data,~C:Type,~R:Type,~E:Data,~descriptor:G.HierarchyDescriptor<S>,observed:W.World<S,A.Store<S,C>,R,A.Notice<S,E>> & Bool,target:W.Handle<S>,selection:Selection) -> W.World<S,A.Store<S,C>,R,A.Notice<S,E>> & Maybe<&2,P.Path<S>>:
31  match observed:
32    case (world,False{}): (world,None{})
33    case (world,True{}): present_path(~S,~C,~R,~E,W.with_store(~S,~A.Store<S,C>,~R,~A.Notice<S,E>,~P.Path<S>,store => store_path(~S,~C,store,Reorder.descriptor(~S,descriptor),target,selection),world))

Uses (15)

Used by (1)