Binds a concrete entity component so extracted methods can update that live component transactionally.
Signature
func bind[C](entity: Entity) -> ComponentReference[C]C means a concrete type selector, never a trait. The reference owns an entity and component identity; extracted mutating methods commit back transactionally and fail if the component is unavailable.
Parameters
entity: Entity- An entity with the selected concrete type component.
Returns
ComponentReference[C]A ComponentReference[C] whose mutating extracted methods write back to that entity.
Examples
Bind a live component
A bound mutating method commits its component update.
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
Rust interpreter builtin dispatch; C must name a concrete type and produces ComponentReference[C] for typed function values.
View Rust documentation →Support: runtime