Resettable
A property delegate that instruments resetting it between opmode runs.
This is used in delegate properties. You must pass a function when constructing the resettable property that returns its default value.
Example
object MyAPI : API() {
// The starting value of someState is 10.
private var someState: Int by Resettable { 10 }
fun mutateState() {
// `Resettable` variables can be mutated as normal.
someState = 15
assert(someState == 15)
}
}
Content copied to clipboard