pub struct GraphBuilder<S: WorkflowState = State, M: MergeStrategy<S> = StateMerge> { /* private fields */ }Expand description
Graph 构建器。
Implementations§
Source§impl<S: WorkflowState, M: MergeStrategy<S>> GraphBuilder<S, M>
impl<S: WorkflowState, M: MergeStrategy<S>> GraphBuilder<S, M>
Sourcepub fn canonical_hash(&mut self, hash: u64) -> &mut Self
pub fn canonical_hash(&mut self, hash: u64) -> &mut Self
P0-2: 设置 canonical hash — 由 DSL 层(如 AgentBuilder)调用。
pub fn start(&mut self, node: impl Into<String>) -> &mut Self
pub fn end(&mut self, node: impl Into<String>) -> &mut Self
pub fn node( &mut self, name: impl Into<String>, kind: NodeKind<S, M>, ) -> &mut Self
Sourcepub fn subgraph<Inner, IM, L>(
&mut self,
name: impl Into<String>,
spec: SubgraphSpec<S, Inner, IM, L>,
) -> &mut Selfwhere
S: 'static,
Inner: 'static + WorkflowState,
IM: 'static + MergeStrategy<Inner>,
L: 'static + StateLens<S, Inner>,
pub fn subgraph<Inner, IM, L>(
&mut self,
name: impl Into<String>,
spec: SubgraphSpec<S, Inner, IM, L>,
) -> &mut Selfwhere
S: 'static,
Inner: 'static + WorkflowState,
IM: 'static + MergeStrategy<Inner>,
L: 'static + StateLens<S, Inner>,
便捷方法 — 添加 Subgraph 节点。
pub fn edge( &mut self, from: impl Into<String>, to: impl Into<String>, ) -> PendingEdge<'_, S, M>
pub fn edge_if( &mut self, from: impl Into<String>, to: impl Into<String>, condition: impl Fn(&S) -> bool + Send + Sync + 'static, ) -> PendingEdge<'_, S, M>
pub fn edge_fallback( &mut self, from: impl Into<String>, to: impl Into<String>, ) -> PendingEdge<'_, S, M>
pub fn build(self) -> Result<Graph<S, M>, BuildErrors>
pub fn name(&self) -> &str
Sourcepub fn compile(self) -> Result<Graph<S, M>, BuildErrors>
pub fn compile(self) -> Result<Graph<S, M>, BuildErrors>
构建并编译 — 在 build() 之后运行 Compiler Pass(如 InlinePass)。
Auto Trait Implementations§
impl<S = State, M = StateMerge> !RefUnwindSafe for GraphBuilder<S, M>
impl<S = State, M = StateMerge> !UnwindSafe for GraphBuilder<S, M>
impl<S, M> Freeze for GraphBuilder<S, M>
impl<S, M> Send for GraphBuilder<S, M>
impl<S, M> Sync for GraphBuilder<S, M>
impl<S, M> Unpin for GraphBuilder<S, M>
impl<S, M> UnsafeUnpin for GraphBuilder<S, M>
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