<div class='type'>Function</div>


<a id='references'></a>


<h2 id="writable-state-snapshot-block">writable</h2>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
public inline fun <T : StateRecord, R> T.writable(
    state: StateObject,
    snapshot: Snapshot,
    block: T.() -> R,
): R
```


Call `block` with a writable state record for `snapshot` of the given record. It is assumed that
this is called for the first state record in a state object. If the snapshot is read-only calling
this will throw.





<hr class="docs-overload-divider">


<h2 id="writable-state-block">writable</h2>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
public inline fun <T : StateRecord, R> T.writable(state: StateObject, block: T.() -> R): R
```


Call `block` with a writable state record for the given record. It is assumed that this is called
for the first state record in a state object. A record is writable if it was created in the
current mutable snapshot.