pub struct NativeRef { /* private fields */ }Expand description
A liveness-checked reference to a mounted piece’s realized node — the retained half of the
tweaks API (docs/tweaks.md). Capture one with Decorate::native_ref, then reach the native
widget later (from event handlers, timers) through a toolkit ext accessor. node/with yield
None before mount and after the node’s subtree is disposed, so async races are safe no-ops.
Reads are REACTIVE: inside a binding or memo, node() subscribes to the ref’s mount/clear
transitions (a Trigger underneath), so a label like
label(move || if r.node().is_some() { "live" } else { "cleared" }) updates when the
referenced piece unmounts — the toggle demo on the showcase Tweaks page. (The when-arm’s
disposal lands at the turn boundary, after ordinary bindings re-ran — piggybacking on some
other signal would read a stale mount state; the trigger fires at the actual transition.)
Main-thread only, like every realized-tree type.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NativeRef
impl !RefUnwindSafe for NativeRef
impl !Send for NativeRef
impl !Sync for NativeRef
impl Unpin for NativeRef
impl UnsafeUnpin for NativeRef
impl !UnwindSafe for NativeRef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more