pub enum NodeKind<S: WorkflowState = State, M: MergeStrategy<S> = StateMerge> {
Task(TaskNode<S>),
Condition(ConditionNode<S>),
Barrier(BarrierNode<S>),
Parallel(ParallelNode<S, M>),
External(Arc<dyn FlowNode<S>>),
ExternalLeaf(Arc<dyn LeafNode<S>>),
Subgraph(CompiledSubgraph<S>),
}Expand description
Graph 的 AST — 节点类型枚举。
不实现任何执行 trait。 它只是数据结构。 执行分发由 ExecutionEngine 的 match 负责。
§泛型参数
S— 类型化状态(默认State= HashMap,向后兼容)M— 并行合并策略(仅Parallel变体使用,默认StateMerge)
Variants§
Task(TaskNode<S>)
自定义逻辑
Condition(ConditionNode<S>)
条件分支
Barrier(BarrierNode<S>)
Human-in-the-loop 审批屏障
Parallel(ParallelNode<S, M>)
并行执行多个分支
External(Arc<dyn FlowNode<S>>)
外部节点(由 lellm-agent 等 crate 提供)— 向后兼容,使用 NodeContext
ExternalLeaf(Arc<dyn LeafNode<S>>)
外部 Leaf 节点 — 只能读 State + emit Mutation
Subgraph(CompiledSubgraph<S>)
Subgraph 节点 — 运行时递归执行内层 Graph
CompiledSubgraph 持有类型擦除的 StateProjector, 包含 Graph + Lens + Merge 的执行逻辑。
Trait Implementations§
Source§impl<S: WorkflowState, M: MergeStrategy<S>> Clone for NodeKind<S, M>
impl<S: WorkflowState, M: MergeStrategy<S>> Clone for NodeKind<S, M>
Auto Trait Implementations§
impl<S = State, M = StateMerge> !RefUnwindSafe for NodeKind<S, M>
impl<S = State, M = StateMerge> !UnwindSafe for NodeKind<S, M>
impl<S, M> Freeze for NodeKind<S, M>
impl<S, M> Send for NodeKind<S, M>
impl<S, M> Sync for NodeKind<S, M>
impl<S, M> Unpin for NodeKind<S, M>
impl<S, M> UnsafeUnpin for NodeKind<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