pub struct FutureSignal<T> { /* private fields */ }Expand description
A reactive signal for futures that resolve to a single value.
FutureSignal provides a way to reactively consume values from async futures and automatically
update UI when the future completes. It manages the future lifecycle and provides access to
both the current value and completion state.
The value is always Option<T> where None means the future hasn’t completed yet
and Some(T) means the future has completed with the result.
§Examples
ⓘ
// Simple case: event loop executor
let future_signal = FutureSignal::new(my_future);
// Full customization
let future_signal = FutureSignal::custom(my_future)
.tokio_spawn()
.build();Implementations§
Source§impl<T: 'static> FutureSignal<T>
impl<T: 'static> FutureSignal<T>
Trait Implementations§
Source§impl<T> Clone for FutureSignal<T>
impl<T> Clone for FutureSignal<T>
Source§impl<T> SignalRead<Option<T>> for FutureSignal<T>
impl<T> SignalRead<Option<T>> for FutureSignal<T>
Source§fn id(&self) -> ReactiveId
fn id(&self) -> ReactiveId
get the Signal Id
Source§fn try_read(&self) -> Option<ReadRef<'_, Option<T>>>where
T: 'static,
fn try_read(&self) -> Option<ReadRef<'_, Option<T>>>where
T: 'static,
If the signal isn’t disposed,
reads the data stored in the Signal and subscribes to the current running effect.
Source§fn try_read_untracked(&self) -> Option<ReadRef<'_, Option<T>>>where
T: 'static,
fn try_read_untracked(&self) -> Option<ReadRef<'_, Option<T>>>where
T: 'static,
If the signal isn’t disposed,
reads the data stored in the Signal without subscribing.
Source§fn read(&self) -> ReadRef<'_, T>where
T: 'static,
fn read(&self) -> ReadRef<'_, T>where
T: 'static,
Reads the data stored in the Signal, subscribing the current running effect.
Source§fn read_untracked(&self) -> ReadRef<'_, T>where
T: 'static,
fn read_untracked(&self) -> ReadRef<'_, T>where
T: 'static,
Reads the data stored in the Signal without subscribing.
Source§impl<T> SignalTrack<Option<T>> for FutureSignal<T>
impl<T> SignalTrack<Option<T>> for FutureSignal<T>
Source§impl<T> SignalWith<Option<T>> for FutureSignal<T>
impl<T> SignalWith<Option<T>> for FutureSignal<T>
Source§fn id(&self) -> ReactiveId
fn id(&self) -> ReactiveId
get the Signal Id
fn with<O>(&self, f: impl FnOnce(&T) -> O) -> Owhere
T: 'static,
fn with_untracked<O>(&self, f: impl FnOnce(&T) -> O) -> Owhere
T: 'static,
fn try_with<O>(&self, f: impl FnOnce(Option<&T>) -> O) -> Owhere
T: 'static,
fn try_with_untracked<O>(&self, f: impl FnOnce(Option<&T>) -> O) -> Owhere
T: 'static,
impl<T> Copy for FutureSignal<T>
Auto Trait Implementations§
impl<T> Freeze for FutureSignal<T>
impl<T> RefUnwindSafe for FutureSignal<T>where
T: RefUnwindSafe,
impl<T> !Send for FutureSignal<T>
impl<T> !Sync for FutureSignal<T>
impl<T> Unpin for FutureSignal<T>where
T: Unpin,
impl<T> UnwindSafe for FutureSignal<T>where
T: UnwindSafe,
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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