pub struct Owner(/* private fields */);Expand description
Identifier for an Owner slot in the runtime’s owner map.
Generational — disposing an owner invalidates outstanding
Owners pointing at the same slot index.
Implementations§
Source§impl Owner
impl Owner
Sourcepub fn new(parent: Option<Owner>) -> Owner
pub fn new(parent: Option<Owner>) -> Owner
Create a new owner. If parent is None the current
top-of-stack owner is used (or the owner becomes a root if
the stack is empty).
The new owner inherits its parent’s paused flag — so a
sub-component mounted while its containing route is
suspended starts paused, and its effects won’t fire until
the route resumes.
Sourcepub fn with<R>(self, f: impl FnOnce() -> R) -> R
pub fn with<R>(self, f: impl FnOnce() -> R) -> R
Push self as the current scope, run f, pop back.
Reactive primitives (signal(), effect(), computed(),
view elements created via render!) allocated inside f
will belong to this owner.
Sourcepub fn dispose(self)
pub fn dispose(self)
Dispose self, freeing all its descendants, nodes, and
running its cleanup callbacks.
Recursive — disposes children first, then this owner. Safe to call even if the owner has already been disposed (no-op).
Sourcepub fn pause(self)
pub fn pause(self)
Pause self (and its descendants): effects and computeds
whose scope is the paused subtree skip flush. Their
scheduled re-runs land on the runtime’s deferred list
until Owner::resume drains them back.
Idempotent — pausing an already-paused owner is a no-op.
The cascade walks the children tree breadth-first; new
descendants created while paused inherit the flag via
Owner::new.
Used by StackLayout to freeze back-stack entries that are
mounted-but-off-screen, matching iOS
UINavigationController / Android Fragment back-stack
semantics: state survives but no CPU is spent on
signal-driven re-renders behind the top route.
Sourcepub fn resume(self)
pub fn resume(self)
Resume self (and its descendants): clear the paused flag
and move any of its deferred effects back onto the pending
queue so they fire on the next flush.
Idempotent. Iterates super::runtime::ReactiveRuntime::deferred
and re-queues every node whose owner is no longer paused —
including descendants resumed by this cascade, and any
deferred node whose owner happens to have been unpaused by
an earlier call.
Trait Implementations§
impl Copy for Owner
impl Eq for Owner
Source§impl Key for Owner
impl Key for Owner
Source§fn null() -> Self
fn null() -> Self
new_key_type!, which calls this
method). Read more