pub struct Task { /* private fields */ }
Expand description
A task’s unique identifier.
Task
is a unique identifier for a task that has been spawned onto the runtime. It can be used to cancel the task
Implementations§
source§impl Task
impl Task
sourcepub fn new(task: impl Future<Output = ()> + 'static) -> Task
pub fn new(task: impl Future<Output = ()> + 'static) -> Task
Start a new future on the same thread as the rest of the VirtualDom.
This future will not contribute to suspense resolving, so you should primarily use this for reacting to changes and long running tasks.
Whenever the component that owns this future is dropped, the future will be dropped as well.
Spawning a future onto the root scope will cause it to be dropped when the root component is dropped - which will only occur when the VirtualDom itself has been dropped.
sourcepub fn cancel(self)
pub fn cancel(self)
Drop the task immediately.
This does not abort the task, so you’ll want to wrap it in an abort handle if that’s important to you
sourcepub fn set_active(&self, active: bool)
pub fn set_active(&self, active: bool)
Set the task as active or paused.
Trait Implementations§
impl Copy for Task
impl Eq for Task
impl StructuralPartialEq for Task
Auto Trait Implementations§
impl Freeze for Task
impl RefUnwindSafe for Task
impl !Send for Task
impl !Sync for Task
impl Unpin for Task
impl UnwindSafe for Task
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)