Struct shred::DispatcherBuilder [] [src]

pub struct DispatcherBuilder<'t> { /* fields omitted */ }

Builder for the Dispatcher.

Examples

This is how you create a dispatcher with a shared thread pool:

let dispatcher = DispatcherBuilder::new()
    .add(task_a, "a", &[])
    .add(task_b, "b", &["a"]) // b depends on a
    .add(task_c, "c", &["a"]) // c also depends on a
    .add(task_d, "d", &[])
    .add(task_e, "e", &["c", "d"]) // e executes after c and d are finished
    .finish();

Methods

impl<'t> DispatcherBuilder<'t>
[src]

Creates a new DispatcherBuilder by using the Default implementation.

The default behaviour is to create a thread pool on finish. If you already have a rayon ThreadPool, it's highly recommended to configure this builder to use it with with_pool instead.

Adds a new task with a given name and a list of dependencies. Please not that the dependency should be added before you add the depending task.

Panics

  • if the specified dependency does not exist

Attach a rayon thread pool to the builder and use that instead of creating one.

Builds the Dispatcher.

In the future, this method will precompute useful information in order to speed up dispatching.

Trait Implementations

impl<'t> Default for DispatcherBuilder<'t>
[src]

Returns the "default value" for a type. Read more