pub struct RunnableParallel { /* private fields */ }Expand description
Executes named runnables concurrently and collects results as a JSON object.
Each step receives a clone of the input. Results are collected into a
serde_json::Value::Object keyed by the step names.
§Example
let par = RunnableParallel::new(vec![
("a".into(), Box::new(RunnablePassthrough) as Box<dyn RunnableCore>),
("b".into(), Box::new(RunnablePassthrough) as Box<dyn RunnableCore>),
]);Implementations§
Trait Implementations§
Source§impl RunnableCore for RunnableParallel
impl RunnableCore for RunnableParallel
Source§fn invoke<'a>(
&'a self,
input: Value,
config: Option<&'a RunnableConfig>,
) -> BoxFuture<'a, Result<Value, SynwireError>>
fn invoke<'a>( &'a self, input: Value, config: Option<&'a RunnableConfig>, ) -> BoxFuture<'a, Result<Value, SynwireError>>
Invoke the runnable with a single input.
Source§fn batch<'a>(
&'a self,
inputs: Vec<Value>,
config: Option<&'a RunnableConfig>,
) -> BoxFuture<'a, Result<Vec<Value>, SynwireError>>
fn batch<'a>( &'a self, inputs: Vec<Value>, config: Option<&'a RunnableConfig>, ) -> BoxFuture<'a, Result<Vec<Value>, SynwireError>>
Invoke on multiple inputs. Default implementation calls
invoke sequentially for each input.Source§fn stream<'a>(
&'a self,
input: Value,
config: Option<&'a RunnableConfig>,
) -> BoxFuture<'a, Result<BoxStream<'a, Result<Value, SynwireError>>, SynwireError>>
fn stream<'a>( &'a self, input: Value, config: Option<&'a RunnableConfig>, ) -> BoxFuture<'a, Result<BoxStream<'a, Result<Value, SynwireError>>, SynwireError>>
Stream results. Default implementation wraps
invoke
as a single-item stream.Auto Trait Implementations§
impl Freeze for RunnableParallel
impl !RefUnwindSafe for RunnableParallel
impl Send for RunnableParallel
impl Sync for RunnableParallel
impl Unpin for RunnableParallel
impl UnsafeUnpin for RunnableParallel
impl !UnwindSafe for RunnableParallel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more