11namespace portals::ui::detail {
34void retireSceneCallback(
void *storage,
void (*reset)(
void *)
noexcept)
noexcept;
41 : scene_(std::move(scene)), previous_(current_) {
56 static std::weak_ptr<SceneAnchor>
snapshot() noexcept {
57 return current_ ? current_->scene_ : std::weak_ptr<SceneAnchor>{};
61 std::weak_ptr<SceneAnchor> scene_;
75 : scene_(std::move(scene)), callback_(std::in_place, std::move(callback)) {
83 : scene_(std::move(other.scene_)), callback_(std::move(other.callback_)) {
88 retireSceneCallback(&callback_, [](
void *storage)
noexcept {
89 static_cast<std::optional<Callback> *
>(storage)->reset();
94 explicit operator bool()
const {
99 if constexpr (
requires {
static_cast<bool>(*callback_); }) {
100 return static_cast<bool>(*callback_);
110 template <
class... Args>
111 requires std::invocable<Callback &, Args...>
112 decltype(
auto)
operator()(Args &&...args)
const {
116 return std::invoke(*callback_, std::forward<Args>(args)...);
120 std::weak_ptr<SceneAnchor> scene_;
121 mutable std::optional<Callback> callback_;
CurrentSceneCallback(const CurrentSceneCallback &)=default
Copy the weak publication and the original owning callable.
CurrentSceneCallback(std::weak_ptr< SceneAnchor > scene, Callback &&callback)
Definition current_scene.hpp:74
~CurrentSceneCallback()
Retire owned captures while both setup and current-scene attribution are suspended.
Definition current_scene.hpp:87
CurrentSceneCallback(CurrentSceneCallback &&other)
Definition current_scene.hpp:82
Allocation-free UI execution publication; an empty scope suspends the caller's scene.
Definition current_scene.hpp:37
~CurrentSceneScope()
Restore the previous publication before returning to the caller.
Definition current_scene.hpp:51
CurrentSceneScope & operator=(const CurrentSceneScope &)=delete
A linked stack publication cannot be reassigned.
CurrentSceneScope(std::weak_ptr< SceneAnchor > scene={}) noexcept
Definition current_scene.hpp:40
CurrentSceneScope(const CurrentSceneScope &)=delete
A linked stack publication cannot be copied.
static std::weak_ptr< SceneAnchor > snapshot() noexcept
Definition current_scene.hpp:56
Suspend an unrelated setup collector during an independently owned callback.
Definition current_scene.hpp:16
SetupFailurePause(const SetupFailurePause &)=delete
A linked stack pause cannot be copied.
SetupFailurePause & operator=(const SetupFailurePause &)=delete
A linked stack pause cannot be reassigned.
~SetupFailurePause()
Restore the setup attribution active before this entered callback.
SetupFailurePause(const std::weak_ptr< SceneAnchor > &scene) noexcept
Allocation-free current-thread setup context; nested independent scopes restore their parent.
Definition setup_failure.hpp:57
Stable weak facade publication; mutable fields are accessed only after UI admission.
Definition ui_scene.hpp:209