49 _promise.set_value(std::move(
value));
61 _promise.set_exception(
62 std::make_exception_ptr(PromiseError(
error)));
82 std::promise<T> _promise;
106 _promise.set_value();
114 _promise.set_exception(
115 std::make_exception_ptr(PromiseError(
error)));
127 struct PromiseError {
132 std::promise<void> _promise;
Lightweight error code wrapper for the promeki library.
Definition error.h:39
Dynamic array container wrapping std::vector.
Definition list.h:40
~Promise()=default
Destructor.
void setValue()
Signals completion (no value).
Definition promise.h:105
Promise()=default
Constructs a Promise.
void setError(Error error)
Sets an error on the promise.
Definition promise.h:113
Future< void > future()
Returns the Future associated with this Promise.
Definition promise.h:122
Promise wrapping std::promise<T>.
Definition promise.h:27
Promise()=default
Constructs a Promise.
Future< T > future()
Returns the Future associated with this Promise.
Definition promise.h:69
void setError(Error error)
Sets an error on the promise.
Definition promise.h:60
Promise & operator=(Promise &&other)=default
Move assignment.
~Promise()=default
Destructor.
Promise(Promise &&other)=default
Move constructor.
void setValue(T value)
Sets the result value.
Definition promise.h:48
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19
const T & value(const Result< T > &r)
Returns the value from a Result.
Definition result.h:56
const Error & error(const Result< T > &r)
Returns the error from a Result.
Definition result.h:65