Skip to main content
Log in

Mojo function

run

run(owned handle: Coroutine[type, origins], out result: type)

Executes a coroutine and waits for its completion.

This function runs the given coroutine on the async runtime and blocks until it completes. The result of the coroutine is stored in the output parameter.

Args:

  • handle (Coroutine[type, origins]): The coroutine to execute. Ownership is transferred.

Returns:

The result output parameter is initialized with the coroutine's result.

run(owned handle: RaisingCoroutine[type, origins], out result: type)

Executes a raising coroutine and waits for its completion.

This function runs the given raising coroutine on the async runtime and blocks until it completes. The result of the coroutine is stored in the output parameter. If the coroutine raises an error, that error is propagated to the caller.

Args:

  • handle (RaisingCoroutine[type, origins]): The raising coroutine to execute. Ownership is transferred.

Returns:

The result output parameter is initialized with the coroutine's result.