Trait orchestrator::executor::AddExecutor

source ·
pub trait AddExecutor<Input: ExecutorState, Out: ExecutorState> {
    // Required methods
    fn add_executor<F, E, Data>(
        &mut self,
        f: fn(_: Input, _: Data) -> F,
        data: Data,
    ) -> impl Future<Output = Result<(), Box<dyn StdError + Send + Sync + 'static>>>
       where F: Future<Output = Result<Out, E>> + 'static + Send + Sync,
             E: Into<Box<dyn StdError + Send + Sync>>,
             Data: Serialize + for<'a> Deserialize<'a> + 'static;
    fn enable_executor_typed<Data: Serialize>(
        &mut self,
        i: &Input,
        o: &Out,
        data: Data,
    ) -> impl Future<Output = Result<(), Error>>;
}
Expand description

Add Executor Trait

Required Methods§

source

fn add_executor<F, E, Data>( &mut self, f: fn(_: Input, _: Data) -> F, data: Data, ) -> impl Future<Output = Result<(), Box<dyn StdError + Send + Sync + 'static>>>
where F: Future<Output = Result<Out, E>> + 'static + Send + Sync, E: Into<Box<dyn StdError + Send + Sync>>, Data: Serialize + for<'a> Deserialize<'a> + 'static,

method used to register an executor:

it also checks if the executor does work. In order to do that it create the default Input, and then call’s the function. If it works adds it to the executor register.

source

fn enable_executor_typed<Data: Serialize>( &mut self, i: &Input, o: &Out, data: Data, ) -> impl Future<Output = Result<(), Error>>

Function used to enable a particular executor

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<S, Input, Output> AddExecutor<Input, Output> for Orchestrator<S>
where S: ExecutorGlobalState + Sized, Input: TryFrom<S> + Into<S> + ExecutorState + Any, Output: Into<S> + ExecutorState,