pub struct ConditionNode {
pub name: String,
pub branches: Vec<(String, BranchCondition)>,
pub otherwise_target: Option<String>,
}Expand description
条件分支节点。
Fields§
§name: String§branches: Vec<(String, BranchCondition)>§otherwise_target: Option<String>兜底目标 — 当所有 branch 条件均不匹配时,跳转到此节点。 未设置时,无匹配则返回 TerminalError。
Implementations§
Source§impl ConditionNode
impl ConditionNode
pub fn builder(name: impl Into<String>) -> ConditionNodeBuilder
Trait Implementations§
Source§impl GraphNode for ConditionNode
impl GraphNode for ConditionNode
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 mut State,
) -> Pin<Box<dyn Future<Output = Result<NextStep, GraphError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 mut State,
) -> Pin<Box<dyn Future<Output = Result<NextStep, GraphError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
执行节点逻辑(阻塞模式)。
Source§fn execute_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut State,
_sink: &'life2 Sender<GraphEvent>,
span_id: SpanId,
) -> Pin<Box<dyn Future<Output = Result<StreamNodeResult, GraphError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute_stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 mut State,
_sink: &'life2 Sender<GraphEvent>,
span_id: SpanId,
) -> Pin<Box<dyn Future<Output = Result<StreamNodeResult, GraphError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
执行节点逻辑(流式模式),将内部事件转发到 channel。 Read more
Auto Trait Implementations§
impl !RefUnwindSafe for ConditionNode
impl !UnwindSafe for ConditionNode
impl Freeze for ConditionNode
impl Send for ConditionNode
impl Sync for ConditionNode
impl Unpin for ConditionNode
impl UnsafeUnpin for ConditionNode
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