pub struct TaskGroup { /* private fields */ }
Expand description
A simple wrapper for TaskGroup
that stores the TaskGroup
in an Arc
so it can be passed
between threads.
Implementations§
Source§impl TaskGroup
impl TaskGroup
pub fn new() -> Self
Sourcepub fn as_weak(&self) -> WeakTaskGroup
pub fn as_weak(&self) -> WeakTaskGroup
Creates a new WeakTaskGroup from this group.
Sourcepub fn spawn(&self, future: impl Future<Output = ()> + Send + 'static)
pub fn spawn(&self, future: impl Future<Output = ()> + Send + 'static)
Spawns a new task in this TaskGroup.
If join
has been called on a clone of this TaskGroup, spawn
will drop the task instead.
§Panics
spawn
may panic if not called in the context of an executor (e.g.
within a call to run
or run_singlethreaded
).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TaskGroup
impl RefUnwindSafe for TaskGroup
impl Send for TaskGroup
impl Sync for TaskGroup
impl Unpin for TaskGroup
impl UnwindSafe for TaskGroup
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)