Skip to main content

TaskGroup

Trait TaskGroup 

Source
pub trait TaskGroup: Send + 'static {
    type Task: Task;

    // Required method
    fn tasks(self) -> Vec<Self::Task>;

    // Provided method
    fn launch(self) -> Result<(), Box<dyn Error + Send + Sync>>
       where Self: Sized { ... }
}
Expand description

A group of tasks executed in parallel.

Implement this on a custom class that manages tasks in a unique way. The caller only needs to return the vector of tasks; the runtime handles reporting and the TUI when launch() is called.

Required Associated Types§

Source

type Task: Task

The task type executed by this group.

Required Methods§

Source

fn tasks(self) -> Vec<Self::Task>

Return the tasks managed by this group.

Provided Methods§

Source

fn launch(self) -> Result<(), Box<dyn Error + Send + Sync>>
where Self: Sized,

Launch all tasks until their total iteration limit is hit.

Examples found in repository?
examples/dummy_project/main.rs (line 12)
11fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
12    DummyTaskGroup::new(4, 20).launch()
13}

Implementors§