|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
morph::reactive::Store: user-intent view state, changed only by exhaustive messages. More...
#include <concepts>#include <exception>#include <functional>#include <memory>#include <type_traits>#include <utility>#include <variant>#include "../attributes.hpp"#include "../core/bridge.hpp"#include "../core/callback_scope.hpp"#include "../core/registry.hpp"#include "runtime.hpp"Go to the source code of this file.
Classes | |
| struct | morph::reactive::detail::UpdateCoversAll< Update, ViewState, Msg > |
Whether Update handles every alternative of the variant Msg. More... | |
| struct | morph::reactive::detail::UpdateCoversAll< Update, ViewState, std::variant< Alts... > > |
Whether Update handles every alternative of std::variant<Alts...>. More... | |
| struct | morph::reactive::detail::UpdateFrame |
| One update in progress, on the stack of the send() running it. More... | |
| class | morph::reactive::detail::UpdateGuard |
| Marks a Store as inside its update for the guard's lifetime. More... | |
| class | morph::reactive::Store< ViewState, Msg > |
| User-intent view state — what is selected, typed, open — changed only by messages. More... | |
Concepts | |
| concept | morph::reactive::ExhaustiveUpdate |
| An update that handles every message: Update& is invocable as (ViewState&, Alt const&) for each alternative Alt of the std::variant Msg. Any Msg that is not a std::variant is never satisfied. | |
Functions | |
| template<typename ViewState, typename Msg, typename Model, typename Sharing, typename Action, typename ToMsg, typename ToFailMsg> | |
| void | morph::reactive::request (Store< ViewState, Msg > &store, bridge::BridgeHandler< Model, Sharing > &handler, async::CallbackScope const &scope, Action action, ToMsg toMsg, ToFailMsg toFailMsg) |
Executes action and sends its result, or its failure, to store as one message. | |
morph::reactive::Store: user-intent view state, changed only by exhaustive messages.
Specified in docs/spec/reactive/store.md.
Definition in file store.hpp.
| void morph::reactive::request | ( | Store< ViewState, Msg > & | store, |
| bridge::BridgeHandler< Model, Sharing > & | handler, | ||
| async::CallbackScope const & | scope, | ||
| Action | action, | ||
| ToMsg | toMsg, | ||
| ToFailMsg | toFailMsg ) |
Executes action and sends its result, or its failure, to store as one message.
Callbacks land on the handler's GUI executor, which must be the Store's owner; each delivery is one batch. scope gates both. Query and Mutation follow the same delivery rules without a Store to send into.
Every call delivers: there is no latest-wins. Superseding an earlier call means stopping, resetting or destroying the scope it was given; Query provides latest-wins.
A throw from toMsg or from the update it sends to, on the success path, or from toFailMsg, is caught and logged by the Completion delivering it. It is not turned into a failure message.
| ViewState | The Store's state type. |
| Msg | The Store's message variant. |
| Model | The handler's model type. |
| Sharing | The handler's sharing policy. |
| Action | The action type. |
| ToMsg | Callable (Result const&) -> alternative of Msg. |
| ToFailMsg | Callable (std::exception_ptr const&) -> alternative of Msg. |
| store | Receives the message. Must outlive every delivery scope does not gate. |
| handler | Executes the action. |
| scope | Gate: a reply arriving after it is stopped or destroyed is dropped. |
| action | The action. |
| toMsg | Maps the result to a message. |
| toFailMsg | Maps the failure to a message. |