pub trait AsyncChildHandle:
Send
+ Sync
+ Debug {
// Required methods
fn id(&self) -> &str;
fn status(&self) -> Status;
fn run<'life0, 'async_trait>(
&'life0 mut self,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<ChildResult, RunError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn abort(&mut self);
fn is_finished(&self) -> bool;
}Expand description
Async handle to a spawned child.
Provides async control over a child. Use this for children that perform I/O-bound operations like LLM API calls.
§Example
ⓘ
let mut handle = ctx.spawn_child_async(config).await?;
// Run the child (async)
let result = handle.run(input).await?;
// Check status
println!("Status: {:?}", handle.status());
// Abort if needed
handle.abort();§When to Use
| Handle | Use Case |
|---|---|
ChildHandle | CPU-bound, quick sync tasks |
AsyncChildHandle | I/O-bound, network, LLM calls |
Required Methods§
Sourcefn run<'life0, 'async_trait>(
&'life0 mut self,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<ChildResult, RunError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn run<'life0, 'async_trait>(
&'life0 mut self,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<ChildResult, RunError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn is_finished(&self) -> bool
fn is_finished(&self) -> bool
Returns true if the child has completed (success, error, or aborted).