await

suspend fun <F : Failure> Session<F>.await(): SessionResult<F>

Launches the Session if it's not already, awaits for its completion without blocking a thread and resumes when it's complete, returning the resulting value or throwing the corresponding exception if the session was cancelled.

This suspending function is cancellable. If the Job of the current coroutine is cancelled or completed while this suspending function is waiting, this function immediately resumes with CancellationException and cancels the session.

This function handles session's lifecycle appropriately, like Session.TerminalStateListener.

Return

SessionResult