pub struct Signal<T>where
T: 'static,{ /* private fields */ }Expand description
A Copy, !Send reactive value handle (§4.2).
Implementations§
Source§impl<T> Signal<T>where
T: 'static,
impl<T> Signal<T>where
T: 'static,
pub fn new(value: T) -> Signal<T>
Sourcepub fn global(value: T) -> Signal<T>
pub fn global(value: T) -> Signal<T>
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, because 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) -> Signal<T>
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§
Source§impl<T> Binding<T> for Signal<T>where
T: Clone + 'static,
impl<T> Binding<T> for Signal<T>where
T: Clone + 'static,
Source§fn read(&self) -> T
fn read(&self) -> T
Tracked read: the current value, subscribing the running computation to changes.
Source§fn peek(&self) -> T
fn peek(&self) -> T
Untracked read: the current value, subscribing nothing (the reactive world’s “peek”).
Source§fn write_teardown(&self, _v: T)
fn write_teardown(&self, _v: T)
Seal the last preview when its control is disposed. Persistent bindings default to
committing; scope-owned signals have already received the preview and may be gone.
Source§fn write_preview(&self, v: T)
fn write_preview(&self, v: T)
A live write mid-gesture (
Event::ValueChanged): readers must follow, but nothing
durable should key off it. Defaults to Binding::write: a plain signal has no
notion of “durable”, and a degraded backend that never commits stays correct.Source§fn write_commit(&self, v: T)
fn write_commit(&self, v: T)
The settled value that ends a gesture (
Event::ValueCommitted). Defaults to
Binding::write; a day-model field seals its preview session here: one change
record, one undo unit, one UPDATE for the whole drag.impl<T> Copy for Signal<T>where
T: 'static,
Source§impl IntoFocusBinding<FocusBoolMark> for Signal<bool>
impl IntoFocusBinding<FocusBoolMark> for Signal<bool>
Source§impl IntoFraction<SignalMark> for Signal<f64>
impl IntoFraction<SignalMark> for Signal<f64>
fn into_fraction(self) -> FractionSource
Source§impl IntoImageSource<ImageSignalMark> for Signal<ImageSource>
impl IntoImageSource<ImageSignalMark> for Signal<ImageSource>
fn into_image_source(self) -> Reactive<ImageSource>
impl IntoNumberFArg<SigM> for Signal<i64>
impl IntoNumberFArg<SigM> for Signal<f64>
Source§impl<T: Clone + 'static> IntoReactive<T, SignalMark> for Signal<T>
impl<T: Clone + 'static> IntoReactive<T, SignalMark> for Signal<T>
fn into_reactive(self) -> Reactive<T>
Source§impl IntoText<SignalMark> for Signal<String>
impl IntoText<SignalMark> for Signal<String>
fn into_text(self) -> TextSource
Source§impl<T: Clone + 'static> LoadSource<T, SignalMark> for Signal<Load<T>>
impl<T: Clone + 'static> LoadSource<T, SignalMark> for Signal<Load<T>>
Auto Trait Implementations§
impl<T> !Send for Signal<T>
impl<T> !Sync for Signal<T>
impl<T> Freeze for Signal<T>
impl<T> RefUnwindSafe for Signal<T>where
T: RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
Converts
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> ⓘ
Converts
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