pub trait DynAgent: Send + Sync {
type State: AgentState;
// Required method
fn run_boxed<'a>(
&'a self,
ctx: &'a mut RunContext<Self::State>,
) -> Pin<Box<dyn Future<Output = Result<RunOutcome>> + Send + 'a>>;
}Expand description
The dyn-compatible form of Agent.
Implemented for every Agent, so Box::new(my_agent) as BoxAgent<_> just
works. The only difference is one boxed future per run.
Required Associated Types§
Sourcetype State: AgentState
type State: AgentState
The run’s shared state — see Agent::State.
Required Methods§
Sourcefn run_boxed<'a>(
&'a self,
ctx: &'a mut RunContext<Self::State>,
) -> Pin<Box<dyn Future<Output = Result<RunOutcome>> + Send + 'a>>
fn run_boxed<'a>( &'a self, ctx: &'a mut RunContext<Self::State>, ) -> Pin<Box<dyn Future<Output = Result<RunOutcome>> + Send + 'a>>
Serves one run, boxing the future so the trait stays object-safe.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".