template <typename Promise>
class future_impl
Defined at line 1075 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
Future implementation details.
See |fpromise::future| documentation for more information.
Public Methods
void future_impl<Promise> ()
Creates a future in the empty state.
Defined at line 1093 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
void future_impl<Promise> (decltype(nullptr) )
Defined at line 1094 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
void future_impl<Promise> (promise_type promise)
Creates a future and assigns a promise to compute its result.
If the promise is empty, the future enters the empty state.
Otherwise the future enters the pending state.
Defined at line 1099 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
void future_impl<Promise> (result_type result)
Creates a future and assigns its result.
If the result is pending, the future enters the empty state.
Otherwise the future enters the ok or error state.
Defined at line 1108 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
void future_impl<Promise> (future_impl<Promise> && other)
Moves from another future, leaving the other one in an empty state.
Defined at line 1115 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
void ~future_impl<Promise> ()
Destroys the promise, releasing its promise and result (if any).
Defined at line 1120 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
future_state state ()
Returns the state of the future: empty, pending, ok, or error.
Defined at line 1123 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
bool operator bool ()
Returns true if the future's state is not |fpromise::future_state::empty|:
it either holds a result or holds a promise that can be invoked to make
progress towards obtaining a result.
Defined at line 1138 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
bool is_empty ()
Returns true if the future's state is |fpromise::future_state::empty|:
it does not hold a result or a promise so it cannot make progress.
Defined at line 1142 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
bool is_pending ()
Returns true if the future's state is |fpromise::future_state::pending|:
it does not hold a result yet but it does hold a promise that can be invoked
to make progress towards obtaining a result.
Defined at line 1147 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
bool is_ok ()
Returns true if the future's state is |fpromise::future_state::ok|:
it holds a value that can be retrieved using |value()|, |take_value()|,
|result()|, |take_result()|, or |take_ok_result()|.
Defined at line 1152 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
bool is_error ()
Returns true if the future's state is |fpromise::future_state::error|:
it holds an error that can be retrieved using |error()|, |take_error()|,
|result()|, |take_result()|, or |take_error_result()|.
Defined at line 1157 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
bool is_ready ()
Returns true if the future's state is either |fpromise::future_state::ok| or
|fpromise::future_state::error|.
Defined at line 1161 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
bool operator() (fpromise::context & context)
Evaluates the future and returns true if its result is ready.
Asserts that the future is not empty.
If the promise completes and returns a result, the future will transition
to the ok or error state according to the result. The promise itself will
then be destroyed since it has fulfilled its purpose.
Defined at line 1169 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
const promise_type & promise ()
Gets a reference to the future's promise.
Asserts that the future's state is |fpromise::future_state::pending|.
Defined at line 1188 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
promise_type take_promise ()
Takes the future's promise, leaving it in an empty state.
Asserts that the future's state is |fpromise::future_state::pending|.
Defined at line 1195 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
result_type & result ()
Gets a reference to the future's result.
Asserts that the future's state is |fpromise::future_state::ok| or
|fpromise::future_state::error|.
Defined at line 1205 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
const result_type & result ()
Defined at line 1209 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
result_type take_result ()
Takes the future's result, leaving it in an empty state.
Asserts that the future's state is |fpromise::future_state::ok| or
|fpromise::future_state::error|.
Defined at line 1217 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
template <typename R = value_type, typename = std::enable_if_t<!std::is_void<R>::value>>
R & value ()
Gets a reference to the future's value.
Asserts that the future's state is |fpromise::future_state::ok|.
Defined at line 1227 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
template <typename R = value_type, typename = std::enable_if_t<!std::is_void<R>::value>>
const R & value ()
Defined at line 1232 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
template <typename R = value_type, typename = std::enable_if_t<!std::is_void<R>::value>>
R take_value ()
Takes the future's value, leaving it in an empty state.
Asserts that the future's state is |fpromise::future_state::ok|.
Defined at line 1240 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
ok_result<value_type> take_ok_result ()
Defined at line 1246 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
template <typename R = error_type, typename = std::enable_if_t<!std::is_void<R>::value>>
R & error ()
Gets a reference to the future's error.
Asserts that the future's state is |fpromise::future_state::error|.
Defined at line 1256 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
template <typename R = error_type, typename = std::enable_if_t<!std::is_void<R>::value>>
const R & error ()
Defined at line 1261 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
template <typename R = error_type, typename = std::enable_if_t<!std::is_void<R>::value>>
R take_error ()
Takes the future's error, leaving it in an empty state.
Asserts that the future's state is |fpromise::future_state::error|.
Defined at line 1269 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
error_result<error_type> take_error_result ()
Defined at line 1275 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
future_impl<Promise> & operator= (future_impl<Promise> && other)
Move assigns from another future, leaving the other one in an empty state.
Defined at line 1283 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
future_impl<Promise> & operator= (decltype(nullptr) )
Discards the future's promise and result, leaving it empty.
Defined at line 1286 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
future_impl<Promise> & operator= (promise_type promise)
Assigns a promise to compute the future's result.
If the promise is empty, the future enters the empty state.
Otherwise the future enters the pending state.
Defined at line 1294 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
future_impl<Promise> & operator= (result_type result)
Assigns the future's result.
If the result is pending, the future enters the empty state.
Otherwise the future enters the ok or error state.
Defined at line 1306 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
void swap (future_impl<Promise> & other)
Swaps the futures' contents.
Defined at line 1316 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
void future_impl<Promise> (const future_impl<Promise> & )
Defined at line 1321 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h
future_impl<Promise> & operator= (const future_impl<Promise> & )
Defined at line 1322 of file ../../sdk/lib/fit-promise/include/lib/fpromise/promise.h