pub trait SpawnerAdapter: Send + Sync {
// Required method
fn spawn<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
engine: &'life1 Engine,
ctx: &'life2 Ctx,
task_id: TaskId,
attempt: u32,
token: CapToken,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Worker>, SpawnError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
First stage of the two-stage pipeline: builds a Box<dyn Worker> for
one attempt. Every concrete spawner (InProcSpawner, ProcessSpawner,
the Operator spawner) implements this; the engine only ever holds a
Arc<dyn SpawnerAdapter> and knows nothing about the Worker shape
behind it.
Required Methods§
Sourcefn spawn<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
engine: &'life1 Engine,
ctx: &'life2 Ctx,
task_id: TaskId,
attempt: u32,
token: CapToken,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Worker>, SpawnError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn spawn<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
engine: &'life1 Engine,
ctx: &'life2 Ctx,
task_id: TaskId,
attempt: u32,
token: CapToken,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Worker>, SpawnError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Spawn one attempt as a worker. Returns Box<dyn Worker>.
The directive argument was removed in design intent: prompts are
pulled on demand through
engine.fetch_prompt(token, task_id, attempt). Spawners are free
to use whatever protocol they like internally — push, pull, or a
hybrid. ProcessSpawner runs fetch_prompt and pushes the
result into the child’s stdin; InProcSpawner injects a prep
snapshot as WorkerInvocation.prompt; a child process could
even re-pull with the token itself.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".