Struct anchor_chain::chain::Chain  
source · pub struct Chain<I, O, L> { /* private fields */ }Expand description
Represents a chain of nodes that can asynchronously process data.
Chain is constructed from a sequence of Node instances, each taking an input
and producing an output. The output of one node serves as the input to the next,
allowing for a flexible and composable approach to complex asynchronous processing tasks.
Implementations§
source§impl<I, O, L> Chain<I, O, L>
 
impl<I, O, L> Chain<I, O, L>
sourcepub fn new(link: L) -> Self
 
pub fn new(link: L) -> Self
Creates a new Chain from the provided initial link.
Link serves as a container for chaining two Node instances together,
where the output of the first node is fed as the input to the next. These
links can be nested to create a chain of nodes.
sourcepub async fn process(&self, input: I) -> Result<O, AnchorChainError>
 
pub async fn process(&self, input: I) -> Result<O, AnchorChainError>
Asynchronously processes the provided input through the chain of nodes.
The input is processed by each node in the chain, with the output of one node serving as the input to the next. The final output of the chain is returned. If any node in the chain returns an error, the processing is halted and the error is returned.