IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
ice::TaskExpected< Result, ErrorType > Struct Template Referencefinal

#include <ice/task_expected.hxx>

Public Types

using ValueType = Result
using PromiseType = ice::TaskExpectedPromise<Result, ErrorType>
using CoroutineType = ice::coroutine_handle<PromiseType>

Public Member Functions

 TaskExpected (CoroutineType coro=nullptr) noexcept
 ~TaskExpected () noexcept
 TaskExpected (TaskExpected const &) noexcept=delete
auto operator= (TaskExpected const &) noexcept=delete
 TaskExpected (TaskExpected &&) noexcept
auto operator= (TaskExpected &&other) noexcept -> TaskExpected &
auto valid () const noexcept
auto result () &noexcept -> Result &
auto result () &&noexcept -> Result &&
auto error () const noexcept -> ErrorType
auto operator co_await () &noexcept
 Awaits the task and returns the result if successful. On failure, resumes the top most coroutine that handles the error explicitly.
auto operator co_await () &&noexcept
 Awaits the task and returns the result if successful. On failure, resumes the top most coroutine that handles the error explicitly.

Member Typedef Documentation

◆ CoroutineType

template<typename Result, typename ErrorType>
using ice::TaskExpected< Result, ErrorType >::CoroutineType = ice::coroutine_handle<PromiseType>

◆ PromiseType

template<typename Result, typename ErrorType>
using ice::TaskExpected< Result, ErrorType >::PromiseType = ice::TaskExpectedPromise<Result, ErrorType>

◆ ValueType

template<typename Result, typename ErrorType>
using ice::TaskExpected< Result, ErrorType >::ValueType = Result

Constructor & Destructor Documentation

◆ TaskExpected() [1/3]

template<typename Result, typename ErrorType>
ice::TaskExpected< Result, ErrorType >::TaskExpected ( CoroutineType coro = nullptr)
inlinenoexcept

◆ ~TaskExpected()

template<typename Result, typename ErrorType>
ice::TaskExpected< Result, ErrorType >::~TaskExpected ( )
inlinenoexcept

◆ TaskExpected() [2/3]

template<typename Result, typename ErrorType>
ice::TaskExpected< Result, ErrorType >::TaskExpected ( TaskExpected< Result, ErrorType > const & )
inlinedeletenoexcept

◆ TaskExpected() [3/3]

template<typename Result, typename ErrorType>
ice::TaskExpected< Result, ErrorType >::TaskExpected ( TaskExpected< Result, ErrorType > && other)
inlinenoexcept

Member Function Documentation

◆ error()

template<typename Result, typename ErrorType>
auto ice::TaskExpected< Result, ErrorType >::error ( ) const -> ErrorType
inlinenoexcept
Returns
The error value stored when task has failed.

◆ operator co_await() [1/2]

template<typename Result, typename ErrorType>
auto ice::TaskExpected< Result, ErrorType >::operator co_await ( ) &&
inlinenoexcept

Awaits the task and returns the result if successful. On failure, resumes the top most coroutine that handles the error explicitly.

Note
If there is no explicit error handling the whole coroutine stack will be suspended and destroyed.
Returns
The Result value on success.

◆ operator co_await() [2/2]

template<typename Result, typename ErrorType>
auto ice::TaskExpected< Result, ErrorType >::operator co_await ( ) &
inlinenoexcept

Awaits the task and returns the result if successful. On failure, resumes the top most coroutine that handles the error explicitly.

Note
If there is no explicit error handling the whole coroutine stack will be suspended and destroyed.
Returns
The Result value on success.

◆ operator=() [1/2]

template<typename Result, typename ErrorType>
auto ice::TaskExpected< Result, ErrorType >::operator= ( TaskExpected< Result, ErrorType > && other) -> TaskExpected &
inlinenoexcept

◆ operator=() [2/2]

template<typename Result, typename ErrorType>
auto ice::TaskExpected< Result, ErrorType >::operator= ( TaskExpected< Result, ErrorType > const & )
inlinedeletenoexcept

◆ result() [1/2]

template<typename Result, typename ErrorType>
auto ice::TaskExpected< Result, ErrorType >::result ( ) && -> Result &&
inlinenoexcept
Returns
The result value stored when task was successful.

◆ result() [2/2]

template<typename Result, typename ErrorType>
auto ice::TaskExpected< Result, ErrorType >::result ( ) & -> Result &
inlinenoexcept
Returns
The result value stored when task was successful.

◆ valid()

template<typename Result, typename ErrorType>
auto ice::TaskExpected< Result, ErrorType >::valid ( ) const
inlinenoexcept
Returns
'true' if the task was successful.
Note
Allows to handle errors explicitly and does not suspend the calling coroutine on error.

The documentation for this struct was generated from the following file: