Skip to main content

Harness

Struct Harness 

Source
pub struct Harness { /* private fields */ }
Available on crate feature async-client only.
Expand description

A running localharness process that has completed its stdio handshake.

Dropping this kills the process.

Implementations§

Source§

impl Harness

Source

pub async fn launch(options: &HarnessOptions) -> Result<Self>

Spawns the binary and performs the length-prefixed stdio handshake.

Source

pub fn port(&self) -> u16

The loopback port the harness bound.

Source

pub fn api_key(&self) -> &str

The per-process key the WebSocket upgrade must present.

Source

pub fn stderr_tail(&self) -> String

The most recent harness stderr, which is where it reports model and configuration failures that never reach the wire.

This is a snapshot: output still in flight is not waited for. Use Self::stderr_after_exit when diagnosing a failure.

Source

pub async fn stderr_after_exit(&self) -> String

The harness’s stderr, waited for.

A harness that hits a fatal error writes the reason to stderr and then exits, which breaks the socket. The client notices the broken socket first — so reading stderr at that instant is a race, and losing it turns a precise “API key not valid” into a bare “connection closed”. This waits (briefly, and only on failure paths) for the pipe to reach EOF, which happens exactly when the process is gone and its output is all in.

Source

pub async fn shutdown(self) -> Result<()>

Waits for the process to exit, having asked it to stop.

Trait Implementations§

Source§

impl Debug for Harness

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V