pub struct Subgraph<P, C>{ /* private fields */ }Expand description
Adapter Node that runs a child graph and projects its state into a
parent update.
Implementations§
Source§impl<P, C> Subgraph<P, C>
impl<P, C> Subgraph<P, C>
Sourcepub fn new(
name: impl Into<String>,
child: CompiledGraph<C>,
project_in: impl Fn(&P) -> C + Send + Sync + 'static,
project_out: impl Fn(&C) -> P::Update + Send + Sync + 'static,
next: Goto,
) -> Self
pub fn new( name: impl Into<String>, child: CompiledGraph<C>, project_in: impl Fn(&P) -> C + Send + Sync + 'static, project_out: impl Fn(&C) -> P::Update + Send + Sync + 'static, next: Goto, ) -> Self
Build a subgraph adapter.
project_in: parent state → fresh child state seed.project_out: final child state → parent update.next: where the parent goes after the subgraph returns.
Trait Implementations§
Source§impl<P, C> Node<P> for Subgraph<P, C>where
P: GraphState + Send + Sync + 'static,
C: GraphState + Clone + Send + Sync + 'static,
<C as GraphState>::Update: Clone,
<P as GraphState>::Update: Send + 'static,
impl<P, C> Node<P> for Subgraph<P, C>where
P: GraphState + Send + Sync + 'static,
C: GraphState + Clone + Send + Sync + 'static,
<C as GraphState>::Update: Clone,
<P as GraphState>::Update: Send + 'static,
Source§fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
parent: &'life1 P,
ctx: &'life2 NodeCtx<'life3>,
) -> Pin<Box<dyn Future<Output = Result<NodeOut<P>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
parent: &'life1 P,
ctx: &'life2 NodeCtx<'life3>,
) -> Pin<Box<dyn Future<Output = Result<NodeOut<P>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Execute one superstep of this node.
Source§fn retry_policy(&self) -> Option<NodeRetryPolicy>
fn retry_policy(&self) -> Option<NodeRetryPolicy>
Per-task retry policy. Default
None means “no retry — propagate
the error”. When Some, the engine retries execute on retryable
errors with exponential backoff.Auto Trait Implementations§
impl<P, C> Freeze for Subgraph<P, C>
impl<P, C> !RefUnwindSafe for Subgraph<P, C>
impl<P, C> Send for Subgraph<P, C>
impl<P, C> Sync for Subgraph<P, C>
impl<P, C> Unpin for Subgraph<P, C>
impl<P, C> UnsafeUnpin for Subgraph<P, C>
impl<P, C> !UnwindSafe for Subgraph<P, C>
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