use super::WorkflowRunner;
use crate::error::RuntimeError;
use crate::runner::in_process::InProcessRunner;
use sayiir_core::codec::sealed;
use sayiir_core::codec::{Codec, EnvelopeCodec};
use sayiir_core::workflow::{Workflow, WorkflowStatus};
pub trait WorkflowRunExt<C, Input, M> {
fn run_once(
&self,
input: Input,
) -> impl std::future::Future<Output = Result<WorkflowStatus, RuntimeError>> + Send + '_
where
Input: Send + 'static,
M: Send + Sync + 'static,
C: Codec + EnvelopeCodec + sealed::EncodeValue<Input>;
}
impl<C, Input, M> WorkflowRunExt<C, Input, M> for Workflow<C, Input, M> {
fn run_once(
&self,
input: Input,
) -> impl std::future::Future<Output = Result<WorkflowStatus, RuntimeError>> + Send + '_
where
Input: Send + 'static,
M: Send + Sync + 'static,
C: Codec + EnvelopeCodec + sealed::EncodeValue<Input>,
{
InProcessRunner.run(self, input)
}
}