pub enum Edge<S: GraphState> {
Normal {
from: NodeId,
to: NodeId,
},
Conditional {
from: NodeId,
router: Arc<dyn EdgeRouter<S>>,
path_map: Option<HashMap<String, NodeId>>,
},
}Expand description
An edge in the state graph.
Edges connect nodes and define the control flow of the graph.
Variants§
Normal
A fixed transition from one node to another.
Conditional
A conditional transition where the target is determined at runtime.
Implementations§
Source§impl<S: GraphState> Edge<S>
impl<S: GraphState> Edge<S>
Sourcepub fn conditional<R: EdgeRouter<S> + 'static>(
from: impl Into<NodeId>,
router: R,
) -> Self
pub fn conditional<R: EdgeRouter<S> + 'static>( from: impl Into<NodeId>, router: R, ) -> Self
Create a conditional edge.
Sourcepub fn conditional_with_map<R: EdgeRouter<S> + 'static>(
from: impl Into<NodeId>,
router: R,
path_map: HashMap<String, NodeId>,
) -> Self
pub fn conditional_with_map<R: EdgeRouter<S> + 'static>( from: impl Into<NodeId>, router: R, path_map: HashMap<String, NodeId>, ) -> Self
Create a conditional edge with a path map.
Sourcepub fn is_conditional(&self) -> bool
pub fn is_conditional(&self) -> bool
Check if this is a conditional edge.
Trait Implementations§
Auto Trait Implementations§
impl<S> !RefUnwindSafe for Edge<S>
impl<S> !UnwindSafe for Edge<S>
impl<S> Freeze for Edge<S>
impl<S> Send for Edge<S>
impl<S> Sync for Edge<S>
impl<S> Unpin for Edge<S>
impl<S> UnsafeUnpin for Edge<S>
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