wwa-coro 0.0.1
Yet Another C++20 Coroutine Library
|
An asynchronous generator that produces values of type Result
.
More...
#include <async_generator.h>
Classes | |
class | iterator |
An input iterator that asynchronously produces values of type Result . More... | |
class | promise_type |
The promise type of the generator. More... | |
Public Member Functions | |
constexpr | async_generator () noexcept=default |
Default constructor. | |
constexpr | async_generator (async_generator &&other) noexcept |
Move constructor. | |
~async_generator () | |
Destructor. | |
auto | begin () noexcept |
Returns an awaitable iterator to the current item of the generator. | |
constexpr auto | end () const noexcept |
Returns a sentinel iterator. | |
async_generator & | operator= (async_generator &&other) noexcept |
Move assignment operator. | |
An asynchronous generator that produces values of type Result
.
The generator is a coroutine that produces values of type Result
asynchronously. Unlike synchronous counterparts, an asynchronous generator can use co_await
in its body. The caller must use co_await
on the begin()
iterator and its increment operator.
Example:
Result | The type of the values produced by the generator. |
Definition at line 47 of file async_generator.h.
|
constexprdefaultnoexcept |
|
inlineconstexprnoexcept |
Move constructor.
Constructs a generator by moving the coroutine handle from another generator.
other | The other generator to move from. |
Definition at line 512 of file async_generator.h.
|
inline |
Destructor.
Destroys the generator and the coroutine handle.
Definition at line 524 of file async_generator.h.
|
inlinenodiscardnoexcept |
Returns an awaitable iterator to the current item of the generator.
This method returns an awaitable iterator to the current item of the generator. Because generators cannot be restarted, this method can be used to iterate over the generator:
co_await
on the return value of this method.Definition at line 576 of file async_generator.h.
|
inlinenodiscardconstexprnoexcept |
Returns a sentinel iterator.
This method returns a sentinel iterator that marks the end of the generator.
Definition at line 592 of file async_generator.h.
|
inlinenoexcept |
Move assignment operator.
Assigns the contents of another generator to this generator by moving them.
other | The other generator to move. |
Definition at line 543 of file async_generator.h.