Skip to content
Konjure / spatial intelligence

bind

← Builtin reference

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.

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

Rust definition

Rust interpreter builtin dispatch; C must name a concrete type and produces ComponentReference[C] for typed function values.

See also