|
wwa-coro 0.0.1
Yet Another C++20 Coroutine Library
|
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 | iterator |
| An input iterator that produces values of type Result. More... | |
| class | promise_type |
| An synchronous generator that produces values of type Result. More... | |
| class | task |
| A coroutine task. More... | |
Functions | |
| ~generator () | |
| Destructor. | |
| template<typename AsyncGenerator, typename Callable> | |
| task< void > | async_for_each (AsyncGenerator gen, Callable callable) |
| iterator | begin () |
| Returns an iterator to the current item of the generator. | |
| constexpr iterator | end () const noexcept |
| Returns a sentinel iterator that marks the end of the generator. | |
| generator () noexcept=default | |
| Default constructor. | |
| generator (generator &&other) noexcept | |
| Move constructor. | |
| generator & | operator= (generator &&other) noexcept |
| Move assignment operator. | |
| template<typename Awaitable, typename... Args> | |
| eager_task | run_awaitable (Awaitable &&f, Args &&... args) |
| Turns any awaitable into an eager fire-and-forget coroutine. | |
Library namespace.
| wwa::coro::~generator | ( | ) |
Destructor.
Destroys the generator and the coroutine handle.
Definition at line 349 of file generator.h.
| task< void > wwa::coro::async_for_each | ( | AsyncGenerator | gen, |
| Callable | callable ) |
Definition at line 607 of file async_generator.h.
|
nodiscard |
Returns an iterator to the current item of the generator.
Returns a constant iterator to the current item of the generator.
This method returns an iterator to the current item of the generator. It is called begin() only to allow the generator to be used in range-based for loops or with ranges.
Because generators cannot be restarted, this method can be used to iterate over the generator:
Definition at line 401 of file generator.h.
|
nodiscardconstexprnoexcept |
Returns a sentinel iterator that marks the end of the generator.
This method returns a sentinel iterator that marks the end of the generator. An attempt to dereference this iterator or iterate past it will result in an exception being thrown.
Definition at line 434 of file generator.h.
|
defaultnoexcept |
Default constructor.
Constructs an empty generator. This constructor is not really useful except for testing.
|
noexcept |
Move constructor.
Constructs a generator by moving the coroutine handle from another generator.
| other | The other generator to move from. |
Definition at line 339 of file generator.h.
Move assignment operator.
Assigns the contents of another generator to this generator by moving them.
| other | The other generator to move. |
Definition at line 369 of file generator.h.
| 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.
| Awaitable | The type of the awaitable callable. |
| Args | The types of the arguments to be passed to the callable. |
| f | The awaitable callable to be invoked. |
| args | The arguments to be passed to the callable. |
Definition at line 129 of file eager_task.h.