blob: e104b87ec7e0c516699d79863e3e8350a96a548e [file] [log] [blame]
<html devsite="true">
<head>
<title>SnapshotKt</title>
{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<h1>SnapshotKt</h1>
<p>
<pre>public final class <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a></pre>
</p>
<hr>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Public methods</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>static&nbsp;final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T</code></td>
<td>
<div><code>&lt;T&nbsp;extends&nbsp;<a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>&gt; <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject)">readable</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&nbsp;receiver,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/StateObject.html">StateObject</a>&nbsp;state<br>)</code></div>
<p>Return the current readable state record for the current snapshot.</p>
</td>
</tr>
<tr>
<td><code>static&nbsp;final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T</code></td>
<td>
<div><code>&lt;T&nbsp;extends&nbsp;<a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>&gt; <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot)">readable</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&nbsp;receiver,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/StateObject.html">StateObject</a>&nbsp;state,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/Snapshot.html">Snapshot</a>&nbsp;snapshot<br>)</code></div>
<p>Return the current readable state record for the <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot)">snapshot</a></code>.</p>
</td>
</tr>
<tr>
<td><code>static&nbsp;final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R</code></td>
<td>
<div><code>&lt;T&nbsp;extends&nbsp;<a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>,&nbsp;R&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).withCurrent(kotlin.Function1)">withCurrent</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&nbsp;receiver,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> r,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R&gt;&nbsp;block<br>)</code></div>
<p>Provides a <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).withCurrent(kotlin.Function1)">block</a></code> with the current record, without notifying any read observers.</p>
</td>
</tr>
<tr>
<td><code>static&nbsp;final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R</code></td>
<td>
<div><code>&lt;T&nbsp;extends&nbsp;<a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>,&nbsp;R&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,kotlin.Function1)">writable</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&nbsp;receiver,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/StateObject.html">StateObject</a>&nbsp;state,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R&gt;&nbsp;block<br>)</code></div>
<p>Call <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,kotlin.Function1)">block</a></code> with a writable state record for the given record.</p>
</td>
</tr>
<tr>
<td><code>static&nbsp;final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R</code></td>
<td>
<div><code>&lt;T&nbsp;extends&nbsp;<a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>,&nbsp;R&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot,kotlin.Function1)">writable</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&nbsp;receiver,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/StateObject.html">StateObject</a>&nbsp;state,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/Snapshot.html">Snapshot</a>&nbsp;snapshot,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R&gt;&nbsp;block<br>)</code></div>
<p>Call <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot,kotlin.Function1)">block</a></code> with a writable state record for <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot,kotlin.Function1)">snapshot</a></code> of the given record.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="list">
<h2>Public methods</h2>
<div class="api-item"><a name="-androidx.compose.runtime.snapshots.StateRecord-.readable-androidx.compose.runtime.snapshots.StateObject-"></a><a name="readable"></a>
<h3 class="api-name" id="(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject)">SnapshotKt.readable</h3>
<pre class="api-signature no-pretty-print">public&nbsp;static&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&nbsp;&lt;T&nbsp;extends&nbsp;<a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>&gt; <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject)">readable</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&nbsp;receiver,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/StateObject.html">StateObject</a>&nbsp;state<br>)</pre>
<p>Return the current readable state record for the current snapshot. It is assumed that <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#&lt;this&gt;()">this</a></code> is the first record of <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject)">state</a></code></p>
</div>
<div class="api-item"><a name="(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject, androidx.compose.runtime.snapshots.Snapshot)"></a><a name="-androidx.compose.runtime.snapshots.StateRecord-.readable-androidx.compose.runtime.snapshots.StateObject-androidx.compose.runtime.snapshots.Snapshot-"></a><a name="readable"></a>
<h3 class="api-name" id="(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot)">SnapshotKt.readable</h3>
<pre class="api-signature no-pretty-print">public&nbsp;static&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&nbsp;&lt;T&nbsp;extends&nbsp;<a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>&gt; <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot)">readable</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&nbsp;receiver,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/StateObject.html">StateObject</a>&nbsp;state,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/Snapshot.html">Snapshot</a>&nbsp;snapshot<br>)</pre>
<p>Return the current readable state record for the <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot)">snapshot</a></code>. It is assumed that <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#&lt;this&gt;()">this</a></code> is the first record of <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).readable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot)">state</a></code></p>
</div>
<div class="api-item"><a name="-androidx.compose.runtime.snapshots.StateRecord-.withCurrent-kotlin.Function1-"></a><a name="withcurrent"></a>
<h3 class="api-name" id="(androidx.compose.runtime.snapshots.StateRecord).withCurrent(kotlin.Function1)">SnapshotKt.withCurrent</h3>
<pre class="api-signature no-pretty-print">public&nbsp;static&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R&nbsp;&lt;T&nbsp;extends&nbsp;<a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>,&nbsp;R&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).withCurrent(kotlin.Function1)">withCurrent</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&nbsp;receiver,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> r,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R&gt;&nbsp;block<br>)</pre>
<p>Provides a <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).withCurrent(kotlin.Function1)">block</a></code> with the current record, without notifying any read observers.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">See also</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#readable(androidx.compose.runtime.snapshots.StateRecord,kotlin.Int,androidx.compose.runtime.snapshots.SnapshotIdSet)">readable</a></code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject, kotlin.Function1)"></a><a name="-androidx.compose.runtime.snapshots.StateRecord-.writable-androidx.compose.runtime.snapshots.StateObject-kotlin.Function1-"></a><a name="writable"></a>
<h3 class="api-name" id="(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,kotlin.Function1)">SnapshotKt.writable</h3>
<pre class="api-signature no-pretty-print">public&nbsp;static&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R&nbsp;&lt;T&nbsp;extends&nbsp;<a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>,&nbsp;R&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,kotlin.Function1)">writable</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&nbsp;receiver,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/StateObject.html">StateObject</a>&nbsp;state,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R&gt;&nbsp;block<br>)</pre>
<p>Call <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,kotlin.Function1)">block</a></code> 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.</p>
</div>
<div class="api-item"><a name="(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject, androidx.compose.runtime.snapshots.Snapshot, kotlin.Function1)"></a><a name="-androidx.compose.runtime.snapshots.StateRecord-.writable-androidx.compose.runtime.snapshots.StateObject-androidx.compose.runtime.snapshots.Snapshot-kotlin.Function1-"></a><a name="writable"></a>
<h3 class="api-name" id="(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot,kotlin.Function1)">SnapshotKt.writable</h3>
<pre class="api-signature no-pretty-print">public&nbsp;static&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R&nbsp;&lt;T&nbsp;extends&nbsp;<a href="/reference/androidx/compose/runtime/snapshots/StateRecord.html">StateRecord</a>,&nbsp;R&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html">SnapshotKt</a>.<a href="/reference/androidx/compose/runtime/snapshots/SnapshotKt.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot,kotlin.Function1)">writable</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&nbsp;receiver,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/StateObject.html">StateObject</a>&nbsp;state,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/compose/runtime/snapshots/Snapshot.html">Snapshot</a>&nbsp;snapshot,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-extension-function-type/index.html">ExtensionFunctionType</a> @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> R&gt;&nbsp;block<br>)</pre>
<p>Call <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot,kotlin.Function1)">block</a></code> with a writable state record for <code><a href="/reference/androidx/compose/runtime/snapshots/package-summary.html#(androidx.compose.runtime.snapshots.StateRecord).writable(androidx.compose.runtime.snapshots.StateObject,androidx.compose.runtime.snapshots.Snapshot,kotlin.Function1)">snapshot</a></code> 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.</p>
</div>
</div>
</body>
</html>