Skip to main content

ChildHandle

Trait ChildHandle 

Source
pub trait ChildHandle:
    Send
    + Sync
    + Debug {
    // Required methods
    fn id(&self) -> &str;
    fn status(&self) -> Status;
    fn run_sync(&mut self, input: Value) -> Result<ChildResult, RunError>;
    fn abort(&mut self);
    fn is_finished(&self) -> bool;
}
Expand description

Handle to a spawned child (synchronous).

Provides control over a child that was spawned via ChildContext::spawn_child().

For async operations, see AsyncChildHandle.

§Example

let mut handle = ctx.spawn_child(config)?;

// Run the child (blocking)
let result = handle.run_sync(input)?;

// Check status
println!("Status: {:?}", handle.status());

// Abort if needed
handle.abort();

Required Methods§

Source

fn id(&self) -> &str

Returns the child’s ID.

Source

fn status(&self) -> Status

Returns the child’s current status.

Source

fn run_sync(&mut self, input: Value) -> Result<ChildResult, RunError>

Runs the child with the given input (blocking).

§Arguments
  • input - Input data for the child
§Returns

The result of the child’s execution.

Source

fn abort(&mut self)

Aborts the child immediately.

Source

fn is_finished(&self) -> bool

Returns true if the child has completed (success, error, or aborted).

Implementors§