pub struct Signal<T: 'static> { /* private fields */ }Expand description
A Copy, !Send reactive value handle (§4.2).
Implementations§
Source§impl<T: 'static> Signal<T>
impl<T: 'static> Signal<T>
pub fn new(value: T) -> Self
Sourcepub fn global(value: T) -> Self
pub fn global(value: T) -> Self
A process-global signal: allocated in the ROOT scope regardless of where the call
runs, so it never dies with a transient caller. Every lazily-initialized global
registry must use this, not Signal::new — a lazy global first touched inside a
presented cover / pushed page / when arm otherwise inherits that scope and is
disposed with it, and every later read panics (the day-l10n locale signal was the
observed case).
pub fn new_in(scope: Scope, value: T) -> Self
pub fn try_with<R>(self, f: impl FnOnce(&T) -> R) -> Option<R>
pub fn with_untracked<R>(self, f: impl FnOnce(&T) -> R) -> R
pub fn get(self) -> Twhere
T: Clone,
pub fn try_get(self) -> Option<T>where
T: Clone,
pub fn get_untracked(self) -> Twhere
T: Clone,
pub fn set(self, value: T)
pub fn set_if_changed(self, value: T)where
T: PartialEq,
pub fn update(self, f: impl FnOnce(&mut T))
Trait Implementations§
impl<T: 'static> Copy for Signal<T>
Auto Trait Implementations§
impl<T> Freeze for Signal<T>
impl<T> RefUnwindSafe for Signal<T>where
T: RefUnwindSafe,
impl<T> !Send for Signal<T>
impl<T> !Sync for Signal<T>
impl<T> Unpin for Signal<T>
impl<T> UnsafeUnpin for Signal<T>
impl<T> UnwindSafe for Signal<T>where
T: RefUnwindSafe,
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
Mutably borrows from an owned value. Read more