withCurrent
Source set: Common
public inline fun <T : StateRecord, R> T.withCurrent(block: (r: T) -> R): R
Provides a block with the current record, without notifying any read observers.
withCurrent
Source set: Common
public inline fun <T : StateRecord, R> T.withCurrent(state: StateObject, block: (r: T) -> R): R
Provides a block with the current record, without notifying any read observers.
Parameters
| state | the state object for which the receiver is a state record. It is assumed that this is the first record of state (e.g. next.withCurrent(this) { ... }). |
| block | a block to be evaluated with the current state record as its parameter. The result of block is the result of withCurrent. It is expected, but not required, that the result of block is either Unit or derives it value from the content of the state record. |
Return
the result returned by the block lambda.