No matching definitions.

ecs/cap

src/ecs/cap.tur

Linear capability tokens for ECS component access.

Since: I1

defopaque

WriteCap

(WriteCap [T] :int)

linear capability proving the holder may write

Since: I1

defopaque

ReadCap

(ReadCap [T] :int))

non-linear capability proving the holder may read

Since: I1

defn

make-write-cap

(make-write-cap [T])

mint a fresh write capability for component T.

cidthe component's CID (or a placeholder where unused)

A `^linear` `WriteCap<T>`. The type parameter T is inferred from the call-site's expected type or ascription.

(def pos-cid 0)
  (let [cap (:: (make-write-cap pos-cid) (WriteCap Pos))]
    (use-cap! cap))

Since: I1

defn

make-read-cap

(make-read-cap [T])

mint a fresh read capability for component T.

cidthe component's CID (or a placeholder where unused)

A `ReadCap<T>` (non-linear).

Since: I1

defn

use-cap!

(use-cap! [T])

consume a linear write capability.

capa `^linear WriteCap<T>` (consumed)

Since: I1