public abstract class StateRecord(
/** The snapshot id of the snapshot in which the record was created. */
internal var snapshotId: SnapshotId
)
Snapshot local value of a state object.
Secondary Constructors
public constructor() : this(currentSnapshot().snapshotId)
public constructor(id: Int) : this(id.toSnapshotId())
Functions
assign
public abstract fun assign(value: StateRecord)
Copy the value into this state record from another for the same state object.
create
public abstract fun create(): StateRecord
Create a new state record for the same state object. Consider also implementing the create overload that provides snapshotId for faster record construction when snapshot id is known.
create
public open fun create(snapshotId: Int): StateRecord
Create a new state record for the same state object and provided snapshotId. This allows to implement an optimized version of create to avoid accessing currentSnapshot when snapshot id is known. The default implementation provides a backwards compatible behavior, and should be overridden if StateRecord subclass supports this optimization.
create
public open fun create(snapshotId: SnapshotId): StateRecord
Create a new state record for the same state object and provided snapshotId. This allows to implement an optimized version of create to avoid accessing currentSnapshot when snapshot id is known. The default implementation provides a backwards compatible behavior, and should be overridden if StateRecord subclass supports this optimization.