Skip to main content

ConditionalEdge

Trait ConditionalEdge 

Source
pub trait ConditionalEdge<S: StateSchema>: Send + Sync {
    // Required method
    fn route<'life0, 'life1, 'async_trait>(
        &'life0 self,
        state: &'life1 S,
    ) -> Pin<Box<dyn Future<Output = Result<String, GraphError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Conditional routing function trait

Routing functions examine the state and return a string key that maps to the next node via the edge’s target map.

Required Methods§

Source

fn route<'life0, 'life1, 'async_trait>( &'life0 self, state: &'life1 S, ) -> Pin<Box<dyn Future<Output = Result<String, GraphError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Route to next node based on state

Returns a string key that matches entries in the edge’s targets map.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<S: StateSchema, F, Fut> ConditionalEdge<S> for AsyncFunctionRouter<S, F>
where F: Fn(&S) -> Fut + Send + Sync, Fut: Future<Output = Result<String, GraphError>> + Send,

Source§

impl<S: StateSchema, F> ConditionalEdge<S> for FunctionRouter<S, F>
where F: Fn(&S) -> String + Send + Sync,