keyPath

fun <Root, Value> keyPath(id: PathId, valueType: TypeId, get: (Root) -> Value): KeyPath<Root, Value>

Creates a total read path with an explicitly supplied structural identity and type token.


inline fun <Root, Value> keyPath(id: PathId, noinline get: (Root) -> Value): KeyPath<Root, Value>

Creates a total read path while capturing its complete focus type token at the call site.


inline fun <Root, Value> keyPath(name: String, noinline get: (Root) -> Value): KeyPath<Root, Value>

Creates a custom read path with a root-local stable name.

The root's complete type token is captured automatically, so two paths with the same name but different root specializations remain distinct. Use the PathId-taking overload only when a custom multi-segment identity is necessary.


@JvmName(name = "listKeyPathAt")
inline fun <Value> keyPath(noinline get: (List<Value>, Int) -> Value, at: Int): KeyPath<List<Value>, Value>

Creates a read path through a List's indexed get operation at at.


@JvmName(name = "arrayKeyPathAt")
inline fun <Value> keyPath(noinline get: (Array<Value>, Int) -> Value, at: Int): KeyPath<Array<Value>, Value>

Creates a read path through an Array's indexed get operation at at.


@JvmName(name = "mutableListKeyPathAt")
inline fun <Value> keyPath(noinline get: (MutableList<Value>, Int) -> Value, at: Int): KeyPath<MutableList<Value>, Value>

Creates a read path through a MutableList's indexed get operation at at.


fun <Root, Value> keyPath(property: KProperty1<Root, Value>, id: PathId, valueType: TypeId): KeyPath<Root, Value>

Adapts a Kotlin property reference into a read-only path.

This intentionally remains read-only even when property happens to be a mutable property. Copy-based writes need an explicit replacement function, and in-place writes require the explicit referenceWritableKeyPath adapter below.


inline fun <Root, Value> keyPath(property: KProperty1<Root, Value>): KeyPath<Root, Value>

Adapts a property reference while capturing its complete root and focus type tokens.