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.
main.kj
Loading…Drag to orbit · select to inspect
0 entities
Scene controls
Results
Loading the language runtime…
Output 0
No output.
State
Compile source to inspect its values.
TraceNo execution yet
- Executed source spans appear here.
Expected output
1
Rust definition
Value::ComponentReference(ComponentReference); an entity ID and canonical component type resolved at invocation.
View Rust documentation →Support: runtime