writableKeyPath

fun <Root, Value> writableKeyPath(id: PathId, valueType: TypeId, get: (Root) -> Value, set: (Root, Value) -> Root): WritableKeyPath<Root, Value>

Creates a copy-based writable path with an explicitly supplied structural identity and type token.


inline fun <Root, Value> writableKeyPath(id: PathId, noinline get: (Root) -> Value, noinline set: (Root, Value) -> Root): WritableKeyPath<Root, Value>

Creates a copy-based writable path while capturing its complete focus type token at the call site. Its root type is part of the caller-supplied PathId.


inline fun <Root, Value> writableKeyPath(name: String, noinline get: (Root) -> Value, noinline set: (Root, Value) -> Root): WritableKeyPath<Root, Value>

Creates a custom copy-based writable path with a root-local stable name.

The root's complete type token is captured automatically. Use the PathId-taking overload only when a custom multi-segment identity is necessary.


Adapts a property reference into a copy-based writable path with an explicitly supplied reconstruction operation.

get provides the readable property KeyPath, while set defines how a replacement value forms a new root. This supports computed read-only properties when the caller can supply an inverse.


inline fun <Root, Value> writableKeyPath(get: KProperty1<Root, Value>, noinline set: (Root, Value) -> Root): WritableKeyPath<Root, Value>

Adapts a property reference into a copy-based writable path while inferring its identity and complete type tokens.


fun <Root : Any, Value> writableKeyPath(property: KMutableProperty1<Root, Value>, id: PathId, valueType: TypeId, copy: (Root) -> Root): WritableKeyPath<Root, Value>

Adapts a mutable property reference into a copy-based writable path.

copy must return a distinct replacement root when value semantics are required. The mutable property setter, including a computed setter, is then invoked on that copied root.


inline fun <Root : Any, Value> writableKeyPath(property: KMutableProperty1<Root, Value>, noinline copy: (Root) -> Root): WritableKeyPath<Root, Value>

Adapts a mutable property reference while inferring its identity and complete type tokens.


inline fun <MapKey, Value> writableKeyPath(noinline get: (Map<MapKey, Value>, MapKey) -> Value?, key: MapKey): WritableKeyPath<Map<MapKey, Value>, Value?>

Creates a copy-based path through a Map's lookup operation at key.