pub struct CliExecutor { /* private fields */ }Expand description
Executor for running prompts through CLI backends.
Implementations§
Source§impl CliExecutor
impl CliExecutor
Sourcepub fn new(backend: CliBackend) -> Self
pub fn new(backend: CliBackend) -> Self
Creates a new executor with the given backend.
Sourcepub async fn execute<W: Write + Send>(
&self,
prompt: &str,
output_writer: W,
timeout: Option<Duration>,
verbose: bool,
) -> Result<ExecutionResult>
pub async fn execute<W: Write + Send>( &self, prompt: &str, output_writer: W, timeout: Option<Duration>, verbose: bool, ) -> Result<ExecutionResult>
Executes a prompt and streams output to the provided writer.
Output is streamed line-by-line to the writer while being accumulated
for the return value. If timeout is provided and the execution produces
no stdout/stderr activity for longer than that duration, the process
receives SIGTERM and the result indicates timeout.
When verbose is true, stderr output is also written to the output writer
with a [stderr] prefix. When false, stderr is captured but not displayed.
Sourcepub async fn execute_capture(&self, prompt: &str) -> Result<ExecutionResult>
pub async fn execute_capture(&self, prompt: &str) -> Result<ExecutionResult>
Executes a prompt without streaming (captures all output).
Uses no timeout by default. For timed execution, use execute_capture_with_timeout.
Sourcepub async fn execute_capture_with_timeout(
&self,
prompt: &str,
timeout: Option<Duration>,
) -> Result<ExecutionResult>
pub async fn execute_capture_with_timeout( &self, prompt: &str, timeout: Option<Duration>, ) -> Result<ExecutionResult>
Executes a prompt without streaming, with optional timeout.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CliExecutor
impl RefUnwindSafe for CliExecutor
impl Send for CliExecutor
impl Sync for CliExecutor
impl Unpin for CliExecutor
impl UnsafeUnpin for CliExecutor
impl UnwindSafe for CliExecutor
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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