pub struct SubgraphNode { /* private fields */ }Expand description
One graph running as a node of another.
See the module documentation for the channel rules.
Implementations§
Source§impl SubgraphNode
impl SubgraphNode
Sourcepub fn new(name: impl Into<String>, graph: Arc<CompiledGraph>) -> Self
pub fn new(name: impl Into<String>, graph: Arc<CompiledGraph>) -> Self
Wraps a compiled graph as a node.
Channels the two schemas declare under the same name pass through in both
directions. Add Self::with_input or Self::with_output for channels
whose names differ, or call Self::isolated to pass nothing implicitly.
Sourcepub fn with_input(
self,
parent: impl Into<String>,
child: impl Into<String>,
) -> Self
pub fn with_input( self, parent: impl Into<String>, child: impl Into<String>, ) -> Self
Feeds a parent channel into a subgraph channel under a different name.
Sourcepub fn with_output(
self,
child: impl Into<String>,
parent: impl Into<String>,
) -> Self
pub fn with_output( self, child: impl Into<String>, parent: impl Into<String>, ) -> Self
Writes a subgraph channel back to a parent channel under a different name.
Sourcepub fn isolated(self) -> Self
pub fn isolated(self) -> Self
Exchanges only the channels named by with_input and with_output.
Without this, a channel both schemas declare under the same name passes through. Isolating is worth the extra naming when the two graphs are maintained apart, because then adding a channel to one cannot silently start feeding the other.
Sourcepub fn graph(&self) -> &Arc<CompiledGraph> ⓘ
pub fn graph(&self) -> &Arc<CompiledGraph> ⓘ
The graph this node runs.
Trait Implementations§
Source§impl Node for SubgraphNode
impl Node for SubgraphNode
Source§fn validate_against(&self, parent: &StateSchema) -> Result<()>
fn validate_against(&self, parent: &StateSchema) -> Result<()>
Rejects a mapping that names a channel the relevant side does not declare.
This runs when the parent compiles, so a mismatch never reaches a run.