pub struct FnRouter<F>where
F: Fn(&AgentState, &GraphConfig) -> Pin<Box<dyn Future<Output = Result<RouterOutput>> + Send>> + Send + Sync,{ /* private fields */ }Expand description
Helper to create a router from an async function
Implementations§
Trait Implementations§
Source§impl<F> RoutingFunction for FnRouter<F>where
F: Fn(&AgentState, &GraphConfig) -> Pin<Box<dyn Future<Output = Result<RouterOutput>> + Send>> + Send + Sync,
impl<F> RoutingFunction for FnRouter<F>where
F: Fn(&AgentState, &GraphConfig) -> Pin<Box<dyn Future<Output = Result<RouterOutput>> + Send>> + Send + Sync,
Source§fn route<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 AgentState,
config: &'life2 GraphConfig,
) -> Pin<Box<dyn Future<Output = Result<RouterOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn route<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
state: &'life1 AgentState,
config: &'life2 GraphConfig,
) -> Pin<Box<dyn Future<Output = Result<RouterOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Returns routing decision.
Return
RouterOutput::Next(None) to end execution.Source§fn semantic_digest(&self) -> String
fn semantic_digest(&self) -> String
Stable caller-visible identity for routing semantics. Implementations
should override this when the route behavior depends on configuration.
Auto Trait Implementations§
impl<F> Freeze for FnRouter<F>where
F: Freeze,
impl<F> RefUnwindSafe for FnRouter<F>where
F: RefUnwindSafe,
impl<F> Send for FnRouter<F>
impl<F> Sync for FnRouter<F>
impl<F> Unpin for FnRouter<F>where
F: Unpin,
impl<F> UnsafeUnpin for FnRouter<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for FnRouter<F>where
F: UnwindSafe,
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