pub struct ManagedTasks { /* private fields */ }Expand description
A Module field connected to its generation-owned task scope during activation.
Declare this as #[tasks] tasks: ManagedTasks on a struct-level Module. The authoring
macro connects it before the Module’s optional Lifecycle::activate hook runs.
Implementations§
Source§impl ManagedTasks
impl ManagedTasks
Sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Returns whether the Module has entered activation and received its task scope.
Sourcepub fn cancellation(&self) -> Result<CancellationToken, ManagedTasksError>
pub fn cancellation(&self) -> Result<CancellationToken, ManagedTasksError>
Returns the cooperative cancellation token for the active Module generation.
Sourcepub fn spawn_local(
&self,
task: impl Future<Output = ()> + 'static,
) -> Result<ManagedTask, ManagedTasksError>
pub fn spawn_local( &self, task: impl Future<Output = ()> + 'static, ) -> Result<ManagedTask, ManagedTasksError>
Spawns work owned by this Module Instance generation.
Trait Implementations§
Source§impl Clone for ManagedTasks
impl Clone for ManagedTasks
Source§fn clone(&self) -> ManagedTasks
fn clone(&self) -> ManagedTasks
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ManagedTasks
impl Debug for ManagedTasks
Source§impl Default for ManagedTasks
impl Default for ManagedTasks
Source§fn default() -> ManagedTasks
fn default() -> ManagedTasks
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for ManagedTasks
impl !Send for ManagedTasks
impl !Sync for ManagedTasks
impl !UnwindSafe for ManagedTasks
impl Freeze for ManagedTasks
impl Unpin for ManagedTasks
impl UnsafeUnpin for ManagedTasks
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