pub struct Graph<S: WorkflowState = State, M: MergeStrategy<S> = StateMerge> { /* private fields */ }Expand description
图(Graph)— 允许有环,循环保护由 GraphExecutor::max_steps 运行时熔断提供。
Implementations§
Source§impl<S: WorkflowState, M: MergeStrategy<S>> Graph<S, M>
impl<S: WorkflowState, M: MergeStrategy<S>> Graph<S, M>
pub fn name(&self) -> &str
pub fn node_names(&self) -> Vec<&str>
pub fn start_node(&self) -> &str
pub fn end_node(&self) -> &str
pub fn edges_from(&self, from: &str) -> Vec<&Edge<S>>
pub fn find_edge(&self, from: &str, to: &str) -> Option<&Edge<S>>
Sourcepub fn resolve_next(&self, current: &str, state: &S) -> Option<String>
pub fn resolve_next(&self, current: &str, state: &S) -> Option<String>
路由解析 — 根据当前节点和 State 找到下一个节点。
pub fn find_fallback_edge(&self, from: &str) -> Option<String>
Sourcepub fn validate(&self) -> Result<(), TerminalError>
pub fn validate(&self) -> Result<(), TerminalError>
验证图结构。
Sourcepub fn analyze(&self) -> GraphDiagnostics
pub fn analyze(&self) -> GraphDiagnostics
完整图诊断分析。
Sourcepub async fn run_inline(
&self,
ctx: &mut NodeContext<'_, S>,
max_steps: usize,
) -> Result<(), GraphError>
pub async fn run_inline( &self, ctx: &mut NodeContext<'_, S>, max_steps: usize, ) -> Result<(), GraphError>
内联执行 — 不产生 RuntimeEvent,不 Checkpoint。
Sourcepub fn analyze_cycles(&self) -> CycleAnalysis
pub fn analyze_cycles(&self) -> CycleAnalysis
@deprecated 使用 analyze() 替代。
Trait Implementations§
Auto Trait Implementations§
impl<S = State, M = StateMerge> !RefUnwindSafe for Graph<S, M>
impl<S = State, M = StateMerge> !UnwindSafe for Graph<S, M>
impl<S, M> Freeze for Graph<S, M>
impl<S, M> Send for Graph<S, M>
impl<S, M> Sync for Graph<S, M>
impl<S, M> Unpin for Graph<S, M>
impl<S, M> UnsafeUnpin for Graph<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