wwa-coro 0.0.1
Yet Another C++20 Coroutine Library
wwa::coro Namespace Reference

Library namespace. More...

Classes

class  async_generator
 An asynchronous generator that produces values of type Result. More...
 
class  bad_result_access
 Exception thrown when accessing a result that is not available. More...
 
class  bad_task
 Exception thrown when a coroutine task is invalid. More...
 
class  eager_task
 Eager coroutine. More...
 
class  generator
 An synchronous generator that produces values of type Result. More...
 
class  task
 A coroutine task. More...
 

Functions

template<typename AsyncGenerator, typename Callable>
task< void > async_for_each (AsyncGenerator gen, Callable callable)
 
template<typename Awaitable, typename... Args>
eager_task run_awaitable (Awaitable &&f, Args &&... args)
 Turns any awaitable into an eager fire-and-forget coroutine.
 

Detailed Description

Library namespace.

Function Documentation

◆ async_for_each()

template<typename AsyncGenerator, typename Callable>
task< void > wwa::coro::async_for_each ( AsyncGenerator gen,
Callable callable )

Definition at line 607 of file async_generator.h.

◆ run_awaitable()

template<typename Awaitable, typename... Args>
eager_task wwa::coro::run_awaitable ( Awaitable && f,
Args &&... args )

Turns any awaitable into an eager fire-and-forget coroutine.

This method template takes an awaitable callable and its arguments, invokes the callable with the provided arguments, and co_await's the result. It effectively runs the awaitable in a fire-and-forget manner.

Template Parameters
AwaitableThe type of the awaitable callable.
ArgsThe types of the arguments to be passed to the callable.
Parameters
fThe awaitable callable to be invoked.
argsThe arguments to be passed to the callable.
Returns
A fire-and-forget task.
Examples
run_awaitable.cpp, and task.cpp.

Definition at line 129 of file eager_task.h.