![]() |
libdisplaydevice master
C++ library to modify display devices.
|
Shared helpers for persistent state wrappers. More...
#include <cstdint>#include <iterator>#include <optional>#include <string_view>#include <vector>#include "display_device/logging.h"#include "display_device/settings_persistence_interface.h"Go to the source code of this file.
Functions | |
| template<typename State , typename SerializeFn > | |
| bool | display_device::detail::persistState (SettingsPersistenceInterface &settings_persistence_api, std::optional< State > &cached_state, const std::optional< State > &state, const SerializeFn &serialize_state, const std::string_view serialize_error_message) |
| Persist state and update the cached copy after a successful write. | |
Shared helpers for persistent state wrappers.
|
nodiscard |
Persist state and update the cached copy after a successful write.
| State | Cached state type. |
| SerializeFn | Callable type used to serialize the state. |
| settings_persistence_api | Persistence API used to store or clear state. |
| cached_state | Cached state to compare and update. |
| state | New state to persist. |
| serialize_state | Callable that serializes a state and updates a success flag. |
| serialize_error_message | Error message used when serialization fails. |