Skip to main content

Parallel

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,
    ) -> 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,
    ) -> 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,
    ) -> ControlFlow<E, ()> { ... }
    fn par_visit<R: IntoIterator<Item = usize>, E: Send, C: Fn(A) -> ControlFlow<E, ()> + Sync>(
        &mut self,
        roots: R,
        callback: C,
    ) -> 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, ) -> ControlFlow<E, ()>

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

See the module documentation for more information on the return 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.

  • filter: The filter function.

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, ) -> ControlFlow<E, ()>

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

See the module documentation for more information on the return value.

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

  • callback: The callback function.

  • filter: The filter function.

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, ) -> ControlFlow<E, ()>

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

See the module documentation for more information on the return 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.

Source

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

Visits the graph from the specified nodes.

See the module documentation for more information on the return value.

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

  • callback: The callback function.

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§