Runnable

Trait Runnable 

Source
pub trait Runnable<I: Send + 'static, O: Send + 'static>: Send + Sync {
    // Required methods
    fn invoke(
        &self,
        input: I,
    ) -> Pin<Box<dyn Future<Output = Result<O, Error>> + Send>>;
    fn clone_to_owned(&self) -> Box<dyn Runnable<I, O> + Send + Sync>;

    // Provided methods
    fn invoke_with_config(
        &self,
        input: I,
        _config: Option<HashMap<String, Value>>,
    ) -> Pin<Box<dyn Future<Output = Result<O, Error>> + Send>> { ... }
    fn batch(
        &self,
        inputs: Vec<I>,
    ) -> Pin<Box<dyn Future<Output = Vec<Result<O, Error>>> + Send>> { ... }
    fn batch_with_config(
        &self,
        inputs: Vec<I>,
        _config: Option<HashMap<String, Value>>,
    ) -> Pin<Box<dyn Future<Output = Vec<Result<O, Error>>> + Send>> { ... }
    fn stream(
        &self,
        input: I,
    ) -> Box<dyn Stream<Item = Result<O, Error>> + Send> { ... }
    fn astream(
        &self,
        _input: I,
    ) -> Pin<Box<dyn Future<Output = Box<dyn Stream<Item = Result<O, Error>> + Send>> + Send>> { ... }
}

Required Methods§

Source

fn invoke( &self, input: I, ) -> Pin<Box<dyn Future<Output = Result<O, Error>> + Send>>

Source

fn clone_to_owned(&self) -> Box<dyn Runnable<I, O> + Send + Sync>

Provided Methods§

Source

fn invoke_with_config( &self, input: I, _config: Option<HashMap<String, Value>>, ) -> Pin<Box<dyn Future<Output = Result<O, Error>> + Send>>

Source

fn batch( &self, inputs: Vec<I>, ) -> Pin<Box<dyn Future<Output = Vec<Result<O, Error>>> + Send>>

Source

fn batch_with_config( &self, inputs: Vec<I>, _config: Option<HashMap<String, Value>>, ) -> Pin<Box<dyn Future<Output = Vec<Result<O, Error>>> + Send>>

Source

fn stream(&self, input: I) -> Box<dyn Stream<Item = Result<O, Error>> + Send>

Source

fn astream( &self, _input: I, ) -> Pin<Box<dyn Future<Output = Box<dyn Stream<Item = Result<O, Error>> + Send>> + Send>>

Trait Implementations§

Source§

impl<I: Send + 'static, O: Send + 'static> Runnable<I, O> for Box<dyn Runnable<I, O> + Send + Sync>

Source§

fn invoke( &self, input: I, ) -> Pin<Box<dyn Future<Output = Result<O, Error>> + Send>>

Source§

fn clone_to_owned(&self) -> Box<dyn Runnable<I, O> + Send + Sync>

Source§

fn invoke_with_config( &self, input: I, _config: Option<HashMap<String, Value>>, ) -> Pin<Box<dyn Future<Output = Result<O, Error>> + Send>>

Source§

fn batch( &self, inputs: Vec<I>, ) -> Pin<Box<dyn Future<Output = Vec<Result<O, Error>>> + Send>>

Source§

fn batch_with_config( &self, inputs: Vec<I>, _config: Option<HashMap<String, Value>>, ) -> Pin<Box<dyn Future<Output = Vec<Result<O, Error>>> + Send>>

Source§

fn stream(&self, input: I) -> Box<dyn Stream<Item = Result<O, Error>> + Send>

Source§

fn astream( &self, _input: I, ) -> Pin<Box<dyn Future<Output = Box<dyn Stream<Item = Result<O, Error>> + Send>> + Send>>

Implementations on Foreign Types§

Source§

impl<I: Send + 'static, O: Send + 'static> Runnable<I, O> for Box<dyn Runnable<I, O> + Send + Sync>

Source§

fn invoke( &self, input: I, ) -> Pin<Box<dyn Future<Output = Result<O, Error>> + Send>>

Source§

fn clone_to_owned(&self) -> Box<dyn Runnable<I, O> + Send + Sync>

Implementors§