pub struct SurfaceHandle(pub u64);Expand description
Identifies which surface (window / layer-surface) a reactive effect belongs to. It is a cheap Copy
id: the reactive runtime stamps one onto every effect at registration and re-enters that surface’s
context before running the effect during a flush, so an effect owned by surface A resolves its
layout/overlay/focus world against A even when a signal set from surface B triggers it (the “owner
scope” model of Solid/Floem).
SurfaceHandle::NONE is the ambient handle used when no surface context is active — single-window
apps, or reactive work outside any surface. Entering NONE, or entering the already-active surface, is
a no-op, so single-surface apps pay ~zero overhead.
reactive-core is the lowest crate and cannot know the per-surface thread-locals (layout/overlay/focus
live in higher crates), so it only stores the id and calls an installed hook (set_surface_enter_hook)
to do the actual context switch.
Tuple Fields§
§0: u64Implementations§
Source§impl SurfaceHandle
impl SurfaceHandle
pub const NONE: SurfaceHandle
pub fn is_none(self) -> bool
Sourcepub fn enter(self) -> SurfaceEnterGuard
pub fn enter(self) -> SurfaceEnterGuard
Activates this surface’s context for as long as the returned guard lives. Fast-path no-op when this surface is already active (single-window: entered once at the top, every effect re-enters the same surface → guard is inert) or when no hook is installed.
Trait Implementations§
Source§impl Clone for SurfaceHandle
impl Clone for SurfaceHandle
Source§fn clone(&self) -> SurfaceHandle
fn clone(&self) -> SurfaceHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more