pub struct Edge<T: State> {
pub from: String,
pub to: String,
pub condition: Option<EdgeCondition<T>>,
pub condition_name: Option<String>,
pub routing_condition: Option<Condition<T>>,
}Expand description
A compiled edge (connection) between two nodes, with optional condition.
Fields§
§from: StringSource node name
to: StringTarget node name
condition: Option<EdgeCondition<T>>Optional condition function (legacy string-based conditions)
condition_name: Option<String>The original condition name from config (for reference)
routing_condition: Option<Condition<T>>Type-safe routing condition (new DSL-based conditions)
Implementations§
Source§impl<T: State> Edge<T>
impl<T: State> Edge<T>
Sourcepub fn new(
from: impl Into<String>,
to: impl Into<String>,
condition: Option<EdgeCondition<T>>,
) -> Self
pub fn new( from: impl Into<String>, to: impl Into<String>, condition: Option<EdgeCondition<T>>, ) -> Self
Create a new edge from source to target.
Sourcepub fn with_condition_name(self, name: impl Into<String>) -> Self
pub fn with_condition_name(self, name: impl Into<String>) -> Self
Attach the original condition name (for reference).
Sourcepub fn with_routing_condition(self, condition: Condition<T>) -> Self
pub fn with_routing_condition(self, condition: Condition<T>) -> Self
Set the type-safe routing condition for this edge
Sourcepub async fn should_take(&self, state: &T) -> Result<bool>
pub async fn should_take(&self, state: &T) -> Result<bool>
Check if this edge should be taken given the current state.
Evaluates both legacy conditions (EdgeCondition) and new conditions (Condition DSL). Returns true if the edge is unconditional or if the condition evaluates to true.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Edge<T>
impl<T> !RefUnwindSafe for Edge<T>
impl<T> Send for Edge<T>
impl<T> Sync for Edge<T>
impl<T> Unpin for Edge<T>
impl<T> UnsafeUnpin for Edge<T>
impl<T> !UnwindSafe for Edge<T>
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