Mojo struct
RaisingCoroutine
Represents a coroutine that can raise.
Coroutines can pause execution saving the state of the program (including values of local variables and the location of the next instruction to be executed). When the coroutine is resumed, execution continues from where it left off, with the saved state restored.
Parametersβ
- βtype (
AnyType
): Type of value returned upon completion of the coroutine. - βlifetimes (
lifetime.set
): The lifetime set of the coroutine's captures.
Implemented traitsβ
AnyType
Methodsβ
__init__
β
__init__(inout self: Self, handle: !co.routine)
Construct a coroutine object from a handle.
Args:
- βhandle (
!co.routine
): The init handle.
__del__
β
__del__(owned self: Self)
Destroy the coroutine object.
__await__
β
__await__(owned self: Self) -> type
Suspends the current coroutine until the coroutine is complete.
Returns:
The coroutine promise.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
π What went wrong?