requireState

fun <A> requireState(requiredState: S, block: () -> A): A

Assert that the lifecycle in the requiredState. Optionally runs block, for the duration of which the lifecycle is guaranteed to stay in requiredState.


fun requireState(requiredState: S)
fun <A> requireState(requiredState: S, throwable: Throwable, block: () -> A): A
fun requireState(errorMessage: (S) -> String = { "Predicate failed on state $it" }, predicate: (S) -> Boolean)


fun <A> requireState(errorMessage: (S) -> String, predicate: (S) -> Boolean, block: () -> A): A

Assert something about the current state atomically.