pub struct Chain { /* private fields */ }
Expand description
A sequential chain is a chain where each step is executed in order, with the output of the previous step being available to the next step.
Implementations§
Source§impl Chain
impl Chain
Sourcepub fn new(steps: Vec<Step>) -> Chain
pub fn new(steps: Vec<Step>) -> Chain
Creates a new Chain
instance with the given sequence of steps.
§Arguments
steps
- A vector ofStep<E>
objects that define the sequence of steps for the chain.
Sourcepub fn of_one(step: Step) -> Chain
pub fn of_one(step: Step) -> Chain
Creates a new Chain
instance with a single step.
§Arguments
step
- AStep<E>
object that defines the single step for the chain.
Sourcepub async fn run<E>(
&self,
parameters: Parameters,
executor: &E,
) -> Result<Output, SequentialChainError>where
E: Executor,
pub async fn run<E>(
&self,
parameters: Parameters,
executor: &E,
) -> Result<Output, SequentialChainError>where
E: Executor,
Executes the chain with the given parameters and executor.
This method runs each step in the chain in sequence, passing the output of the previous step to the next step. If the chain is empty, an error is returned.
§Arguments
parameters
- AParameters
object containing the input parameters for the chain.executor
- A reference to an executor that implements theExecutor
trait.
§Returns
Ok(E::Output)
- If the chain executes successfully, the output of the last step is returned.Err(SequentialChainError<E::Error>)
- If an error occurs during the execution of the chain, the error is returned.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Chain
impl<'de> Deserialize<'de> for Chain
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl StorableEntity for Chain
impl StorableEntity for Chain
fn get_metadata() -> Vec<(String, String)>
fn to_envelope(self) -> Envelope<Self>where
Self: Sized,
fn from_envelope(envelope: Envelope<Self>) -> Self
fn read_file_sync(path: &str) -> Result<Self, EnvelopeError>
fn write_file_sync(self, path: &str) -> Result<(), EnvelopeError>
Auto Trait Implementations§
impl Freeze for Chain
impl RefUnwindSafe for Chain
impl Send for Chain
impl Sync for Chain
impl Unpin for Chain
impl UnwindSafe for Chain
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