|
libstp
Robotics library for Botball
|
Minimal coroutine wrapper that stores the last yielded value and supports manual stepping. More...
#include <algorithm.hpp>
Classes | |
| struct | promise_type |
| Coroutine promise storing the most recent yielded or returned value. More... | |
Public Types | |
| using | handle_type = std::coroutine_handle<promise_type> |
Public Member Functions | |
| AsyncAlgorithm (handle_type h) | |
| AsyncAlgorithm (const AsyncAlgorithm &)=delete | |
| AsyncAlgorithm (AsyncAlgorithm &&other) noexcept | |
| ~AsyncAlgorithm () | |
| bool | advance () |
| Resume the coroutine once. Returns false when the coroutine is finished. | |
| T | current () const |
| Return the last yielded or returned value from the coroutine. | |
| bool | await_ready () const noexcept |
| Awaiter API: reports ready only once the wrapped coroutine is done. | |
| void | await_suspend (std::coroutine_handle<> awaiting_coro) noexcept |
| Awaiter API: resume the wrapped coroutine, then resume the awaiting coroutine. | |
| T | await_resume () noexcept |
| Awaiter API: return the current value after suspension completes. | |
Minimal coroutine wrapper that stores the last yielded value and supports manual stepping.
Definition at line 9 of file algorithm.hpp.
| using libstp::async::AsyncAlgorithm< T >::handle_type = std::coroutine_handle<promise_type> |
Definition at line 32 of file algorithm.hpp.
|
explicit |
|
delete |
|
noexcept |
| libstp::async::AsyncAlgorithm< T >::~AsyncAlgorithm | ( | ) |
| bool libstp::async::AsyncAlgorithm< T >::advance | ( | ) |
Resume the coroutine once. Returns false when the coroutine is finished.
|
nodiscardnoexcept |
Awaiter API: reports ready only once the wrapped coroutine is done.
|
noexcept |
Awaiter API: return the current value after suspension completes.
|
noexcept |
Awaiter API: resume the wrapped coroutine, then resume the awaiting coroutine.
| T libstp::async::AsyncAlgorithm< T >::current | ( | ) | const |
Return the last yielded or returned value from the coroutine.