pub struct UseTask<T: Send + Sync + 'static> { /* private fields */ }Expand description
The handle use_task returns: a read handle to the task’s
AsyncValue<T> state plus a restart/refresh trigger.
Read the state reactively via signal (or the Get
trait on it) from Component::build; call restart to
re-run the fetch (e.g. a pull-to-refresh).
Implementations§
Source§impl<T: Send + Sync + 'static> UseTask<T>
impl<T: Send + Sync + 'static> UseTask<T>
Sourcepub fn signal(&self) -> RwSignal<AsyncValue<T>>
pub fn signal(&self) -> RwSignal<AsyncValue<T>>
The reactive state signal. Read it with the Get trait
(task.signal().get()) inside a tracked Component::build so a state
transition wakes the shell.
Sourcepub fn restart(&self)
pub fn restart(&self)
Re-runs the fetch: transitions the state to
Loading (carrying the current value for
refresh-without-flicker), aborts any in-flight background task, and
starts a fresh one. Last-write-wins by generation, so a restart storm
settles on the newest fetch’s result regardless of completion order.
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for UseTask<T>
impl<T> !Send for UseTask<T>
impl<T> !Sync for UseTask<T>
impl<T> !UnwindSafe for UseTask<T>
impl<T> Freeze for UseTask<T>
impl<T> Unpin for UseTask<T>
impl<T> UnsafeUnpin for UseTask<T>
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> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.