Trait tokio_rayon::AsyncThreadPool[][src]

pub trait AsyncThreadPool {
#[must_use]    fn spawn_async<'life0, 'async_trait, F, R>(
        &'life0 self,
        func: F
    ) -> Pin<Box<dyn Future<Output = Result<R, RecvError>> + Send + 'async_trait>>
    where
        F: FnOnce() -> R + Send + 'static,
        R: Send + 'static,
        F: 'async_trait,
        R: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn spawn_fifo_async<'life0, 'async_trait, F, R>(
        &'life0 self,
        f: F
    ) -> Pin<Box<dyn Future<Output = Result<R, RecvError>> + Send + 'async_trait>>
    where
        F: FnOnce() -> R + Send + 'static,
        R: Send + 'static,
        F: 'async_trait,
        R: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
; }

Extension trait that integrates Rayon’s ThreadPool with Tokio.

Required methods

#[must_use]fn spawn_async<'life0, 'async_trait, F, R>(
    &'life0 self,
    func: F
) -> Pin<Box<dyn Future<Output = Result<R, RecvError>> + Send + 'async_trait>> where
    F: FnOnce() -> R + Send + 'static,
    R: Send + 'static,
    F: 'async_trait,
    R: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Asynchronous wrapper around Rayon’s ThreadPool::spawn.

Runs a function on the global Rayon thread pool with LIFO priority, produciing a future that resolves with the function’s return value.

Errors

Forwards Tokio’s RecvError, i.e. if the channel is closed.

#[must_use]fn spawn_fifo_async<'life0, 'async_trait, F, R>(
    &'life0 self,
    f: F
) -> Pin<Box<dyn Future<Output = Result<R, RecvError>> + Send + 'async_trait>> where
    F: FnOnce() -> R + Send + 'static,
    R: Send + 'static,
    F: 'async_trait,
    R: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Asynchronous wrapper around Rayon’s ThreadPool::spawn_fifo.

Runs a function on the global Rayon thread pool with FIFO priority, produciing a future that resolves with the function’s return value.

Errors

Forwards Tokio’s RecvError, i.e. if the channel is closed.

Loading content...

Implementations on Foreign Types

impl AsyncThreadPool for ThreadPool[src]

Loading content...

Implementors

Loading content...