pub struct ProcessSpawner {
pub program: String,
pub args: Vec<String>,
pub use_stdin: bool,
pub stream_mode: Option<StreamMode>,
}Expand description
A SpawnerAdapter that runs a worker as an external OS process
(a binary or a sh -c one-liner). Configured with the builder
methods below, then registered like any other spawner.
Fields§
§program: StringBinary (or sh, when built via ProcessSpawner::run) to
execute.
args: Vec<String>Extra arguments passed to program, in order.
use_stdin: boolWhether to pipe the directive into the child’s stdin — most LLM
CLIs read prompts that way (--prompt - and friends). When
false, the directive is appended to args instead.
stream_mode: Option<StreamMode>Some(mode) — streaming mode. None — plain mode (the default).
Implementations§
Source§impl ProcessSpawner
impl ProcessSpawner
Sourcepub fn new(program: impl Into<String>) -> Self
pub fn new(program: impl Into<String>) -> Self
Builder entry point: spawn program with no args, stdin piping
on, and plain mode.
Sourcepub fn args(self, args: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn args(self, args: impl IntoIterator<Item = impl Into<String>>) -> Self
Appends multiple arguments at once.
Sourcepub fn use_stdin(self, v: bool) -> Self
pub fn use_stdin(self, v: bool) -> Self
Sets whether the directive/prompt is piped to the child’s stdin
(true, the default) or appended as a trailing arg (false).
Sourcepub fn stream_mode(self, mode: StreamMode) -> Self
pub fn stream_mode(self, mode: StreamMode) -> Self
Set the streaming mode. Default: None (plain mode).
Sourcepub fn ndjson(self, v: bool) -> Self
pub fn ndjson(self, v: bool) -> Self
Compatibility helper: ndjson(true) is equivalent to
.stream_mode(StreamMode::NdjsonLines), and ndjson(false) to
.plain(). A deprecation candidate, kept around for now.
Trait Implementations§
Source§impl SpawnerAdapter for ProcessSpawner
impl SpawnerAdapter for ProcessSpawner
Source§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,
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,
Box<dyn Worker>. Read moreAuto Trait Implementations§
impl Freeze for ProcessSpawner
impl RefUnwindSafe for ProcessSpawner
impl Send for ProcessSpawner
impl Sync for ProcessSpawner
impl Unpin for ProcessSpawner
impl UnsafeUnpin for ProcessSpawner
impl UnwindSafe for ProcessSpawner
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more