run

fun run(block: suspend RunScope.() -> Unit? = null)

Run a section block, applying its commands, thereby rendering them.

A run block blocks the calling thread, only returning control back once it has finished. This is in contrast to the section render block, which runs in parallel on its own thread. It is expected that in most cases, the run block logic will update values that trigger section rerenders.

A run block may run for an arbitrarily long time (e.g. blocking until the user presses 'q' to quit), and while it runs, it keeps the current section it is attached to active.

Without calling this method, the contents of a Section block are inert and useless. In fact, it is considered an error to create a section with no run block. If you forget to do so, the owning Session will notify you about your mistake as early as it can. (When it happens, it is invariably user error).

While you can always call this method directly, there are multiple convenience run variations that delegate to this call under the hood, which may be more appropriate choices based on the purpose of your section,such as runUntilSignal, runUntilInputEntered, and runUntilKeyPressed.