Skip to content
Konjure / spatial intelligence

ComponentReference

← Builtin reference

A typed entity/component identity used to capture live component methods.

Signature

ComponentReference[T] pairs a Rust entity ID with a canonical concrete type name. bind[T](entity) validates that the component exists; method calls resolve it again and commit accepted receiver changes transactionally.

This is an interpreter handle, not a Rust borrow or raw memory reference. Access component data with get and set; invoke methods through the reference. Invoking a reference after its entity disappears is an error.

Examples

Capture a live component method

Calling advance updates the stored component, rather than a copied receiver.

Tick 0 · 0.00 s⌘ / Ctrl + EnterThis device
main.kj
Loading the language runtime…
Output 0
No output.
Expected output
1

Rust definition

Value::ComponentReference(ComponentReference); an entity ID and canonical component type resolved at invocation.

See also