Trait Parallel

Source
pub trait Parallel<A: Event> {
    // Required methods
    fn par_visit_filtered_with<R: IntoIterator<Item = usize>, T: Clone + Send + Sync, E: Send, C: Fn(&mut T, A) -> ControlFlow<E, ()> + Sync, F: Fn(&mut T, A::FilterArgs) -> bool + Sync>(
        &mut self,
        roots: R,
        init: T,
        callback: C,
        filter: F,
        thread_pool: &ThreadPool,
    ) -> ControlFlow<E, ()>;
    fn reset(&mut self);

    // Provided methods
    fn par_visit_filtered<R: IntoIterator<Item = usize>, E: Send, C: Fn(A) -> ControlFlow<E, ()> + Sync, F: Fn(A::FilterArgs) -> bool + Sync>(
        &mut self,
        roots: R,
        callback: C,
        filter: F,
        thread_pool: &ThreadPool,
    ) -> ControlFlow<E, ()> { ... }
    fn par_visit_with<R: IntoIterator<Item = usize>, T: Clone + Send + Sync, E: Send, C: Fn(&mut T, A) -> ControlFlow<E, ()> + Sync>(
        &mut self,
        roots: R,
        init: T,
        callback: C,
        thread_pool: &ThreadPool,
    ) -> ControlFlow<E, ()> { ... }
    fn par_visit<R: IntoIterator<Item = usize>, E: Send, C: Fn(A) -> ControlFlow<E, ()> + Sync>(
        &mut self,
        roots: R,
        callback: C,
        thread_pool: &ThreadPool,
    ) -> ControlFlow<E, ()> { ... }
}
Expand description

A parallel visit.

Implementation of this trait must provide the par_visit_filtered_with method, which should perform a parallel visit of a graph starting from a given set of nodes. Note that different visits types might interpret the set of nodes differently: for example, a breadth-first visit will interpret the set of nodes as the initial queue, whereas a depth-first visit will interpret the set of nodes as a list of nodes from which to start visits.

Required Methods§

Source

fn par_visit_filtered_with<R: IntoIterator<Item = usize>, T: Clone + Send + Sync, E: Send, C: Fn(&mut T, A) -> ControlFlow<E, ()> + Sync, F: Fn(&mut T, A::FilterArgs) -> bool + Sync>( &mut self, roots: R, init: T, callback: C, filter: F, thread_pool: &ThreadPool, ) -> ControlFlow<E, ()>

Visits the graph from the specified nodes with an initialization value and a filter function.

§Arguments
  • roots: The nodes to start the visit from.

  • init: a value the will be cloned and passed to the callback function.

  • callback: The callback function.

  • filter: The filter function.

  • thread_pool: The thread pool to use for parallel computation.

Source

fn reset(&mut self)

Resets the visit status, making it possible to reuse it.

Provided Methods§

Source

fn par_visit_filtered<R: IntoIterator<Item = usize>, E: Send, C: Fn(A) -> ControlFlow<E, ()> + Sync, F: Fn(A::FilterArgs) -> bool + Sync>( &mut self, roots: R, callback: C, filter: F, thread_pool: &ThreadPool, ) -> ControlFlow<E, ()>

Visits the graph from the specified nodes with a filter function.

§Arguments
  • roots: The nodes to start the visit from.

  • callback: The callback function.

  • filter: The filter function.

  • thread_pool: The thread pool to use for parallel computation.

Source

fn par_visit_with<R: IntoIterator<Item = usize>, T: Clone + Send + Sync, E: Send, C: Fn(&mut T, A) -> ControlFlow<E, ()> + Sync>( &mut self, roots: R, init: T, callback: C, thread_pool: &ThreadPool, ) -> ControlFlow<E, ()>

Visits the graph from the specified nodes with an initialization value.

§Arguments
  • roots: The nodes to start the visit from.

  • init: a value the will be cloned and passed to the callback function.

  • callback: The callback function.

  • thread_pool: The thread pool to use for parallel computation.

Source

fn par_visit<R: IntoIterator<Item = usize>, E: Send, C: Fn(A) -> ControlFlow<E, ()> + Sync>( &mut self, roots: R, callback: C, thread_pool: &ThreadPool, ) -> ControlFlow<E, ()>

Visits the graph from the specified nodes.

§Arguments
  • roots: The nodes to start the visit from.

  • callback: The callback function.

  • thread_pool: The thread pool to use for parallel computation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§