Struct fuchsia_async::TaskGroup
source · pub struct TaskGroup { /* private fields */ }
Expand description
Allows the user to spawn multiple Tasks and await them as a unit.
Tasks can be added to this group using TaskGroup::add
.
All pending tasks in the group can be awaited using TaskGroup::join
.
Implementations§
source§impl TaskGroup
impl TaskGroup
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new TaskGroup.
The TaskGroup can be used to await an arbitrary number of Tasks and may consume an arbitrary amount of memory.
sourcepub fn spawn(&mut self, future: impl Future<Output = ()> + Send + 'static)
pub fn spawn(&mut self, future: impl Future<Output = ()> + Send + 'static)
Spawns a new task in this TaskGroup.
To add a future that is not Send
to this TaskGroup, use TaskGroup::add
.
Panics
spawn
may panic if not called in the context of an executor (e.g.
within a call to run
or run_singlethreaded
).
Auto Trait Implementations§
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