Ask

Trait Ask 

Source
pub trait Ask<A> {
    // Required method
    fn ask<'life0, 'async_trait, F, R>(
        &'life0 self,
        f: F,
    ) -> Pin<Box<dyn Future<Output = Result<R, AskError>> + Send + 'async_trait>>
       where F: FnOnce(Box<dyn FnOnce(R) + Send>) -> A + Send + 'async_trait,
             R: Send + 'static + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait;
}

Required Methods§

Source

fn ask<'life0, 'async_trait, F, R>( &'life0 self, f: F, ) -> Pin<Box<dyn Future<Output = Result<R, AskError>> + Send + 'async_trait>>
where F: FnOnce(Box<dyn FnOnce(R) + Send>) -> A + Send + 'async_trait, R: Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

The ask pattern is a way to send a request and get a reply back.

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.

Implementations on Foreign Types§

Source§

impl<A> Ask<A> for Sender<A>
where A: Send,

Source§

fn ask<'life0, 'async_trait, F, R>( &'life0 self, f: F, ) -> Pin<Box<dyn Future<Output = Result<R, AskError>> + Send + 'async_trait>>
where F: FnOnce(Box<dyn FnOnce(R) + Send>) -> A + Send + 'async_trait, R: Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Implementors§