ParallelScheduler

Trait ParallelScheduler 

Source
pub trait ParallelScheduler:
    Clone
    + Sync
    + Send {
    // Required methods
    fn block_in_place<R>(&self, f: impl FnOnce() -> R + Send) -> R
       where R: Send;
    fn parallel_for_each<T>(&self, items: &[T], f: impl Fn(&T) + Send + Sync)
       where T: Sync;
    fn try_parallel_for_each<'l, T, E>(
        &self,
        items: &'l [T],
        f: impl Fn(&'l T) -> Result<(), E> + Send + Sync,
    ) -> Result<(), E>
       where T: Sync,
             E: Send + 'static;
    fn try_parallel_for_each_mut<'l, T, E>(
        &self,
        items: &'l mut [T],
        f: impl Fn(&'l mut T) -> Result<(), E> + Send + Sync,
    ) -> Result<(), E>
       where T: Send + Sync,
             E: Send + 'static;
    fn try_parallel_for_each_owned<T, E>(
        &self,
        items: Vec<T>,
        f: impl Fn(T) -> Result<(), E> + Send + Sync,
    ) -> Result<(), E>
       where T: Send + Sync,
             E: Send + 'static;
    fn parallel_map_collect<'l, Item, PerItemResult, Result>(
        &self,
        items: &'l [Item],
        f: impl Fn(&'l Item) -> PerItemResult + Send + Sync,
    ) -> Result
       where Item: Sync,
             PerItemResult: Send + Sync + 'l,
             Result: FromIterator<PerItemResult>;
    fn parallel_map_collect_owned<Item, PerItemResult, Result>(
        &self,
        items: Vec<Item>,
        f: impl Fn(Item) -> PerItemResult + Send + Sync,
    ) -> Result
       where Item: Send + Sync,
             PerItemResult: Send + Sync,
             Result: FromIterator<PerItemResult>;
}

Required Methods§

Source

fn block_in_place<R>(&self, f: impl FnOnce() -> R + Send) -> R
where R: Send,

Source

fn parallel_for_each<T>(&self, items: &[T], f: impl Fn(&T) + Send + Sync)
where T: Sync,

Source

fn try_parallel_for_each<'l, T, E>( &self, items: &'l [T], f: impl Fn(&'l T) -> Result<(), E> + Send + Sync, ) -> Result<(), E>
where T: Sync, E: Send + 'static,

Source

fn try_parallel_for_each_mut<'l, T, E>( &self, items: &'l mut [T], f: impl Fn(&'l mut T) -> Result<(), E> + Send + Sync, ) -> Result<(), E>
where T: Send + Sync, E: Send + 'static,

Source

fn try_parallel_for_each_owned<T, E>( &self, items: Vec<T>, f: impl Fn(T) -> Result<(), E> + Send + Sync, ) -> Result<(), E>
where T: Send + Sync, E: Send + 'static,

Source

fn parallel_map_collect<'l, Item, PerItemResult, Result>( &self, items: &'l [Item], f: impl Fn(&'l Item) -> PerItemResult + Send + Sync, ) -> Result
where Item: Sync, PerItemResult: Send + Sync + 'l, Result: FromIterator<PerItemResult>,

Source

fn parallel_map_collect_owned<Item, PerItemResult, Result>( &self, items: Vec<Item>, f: impl Fn(Item) -> PerItemResult + Send + Sync, ) -> Result
where Item: Send + Sync, PerItemResult: Send + Sync, Result: FromIterator<PerItemResult>,

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§