Skip to main content

AccessoryWorker

Struct AccessoryWorker 

Source
pub struct AccessoryWorker {
    pub child: Child,
    /* private fields */
}

Fields§

§child: Child

Implementations§

Source§

impl AccessoryWorker

Source

pub fn new(child: Child) -> Result<Self>

Adopt a child with piped stdin/stdout. Windows ownership also attaches a kill-on-close job so a dead parent cannot strand an exclusive device owner.

Source

pub fn new_independent(child: Child) -> Result<Self>

COM imports own the private Regain worker, not vendor helpers it launches.

Source

pub async fn request(&mut self, request: Value) -> Result<Value>

Source

pub async fn collect_json_with_timeout<T: DeserializeOwned>( self, request: Value, deadline: Duration, ) -> Result<Collected<T>>

Release a one-shot worker’s stdin startup barrier only after ownership is attached, then collect bounded JSON and reap it. Consuming self makes timeout/cancellation terminal. Neither stdout nor diagnostics are logged.

Source

pub async fn request_with_timeout( &mut self, request: Value, deadline: Duration, ) -> Result<Value>

Source

pub async fn request_typed_with_timeout<T: DeserializeOwned>( &mut self, request: Value, deadline: Duration, ) -> Result<T>

Deserialize the inner reply directly from its frame. Typed protocols must reject duplicate fields before conversion to a generic JSON map.

Source

pub async fn request_typed_with_stream<T, R, F>( &mut self, request: Value, deadline: Duration, body: F, ) -> Result<R>
where T: DeserializeOwned, F: for<'a> FnOnce(T, &'a mut BufReader<ChildStdout>) -> Pin<Box<dyn Future<Output = Result<R>> + Send + 'a>>,

One acknowledged frame followed by a caller-defined finite binary body. The same process/cancellation guard spans both; a rejected header, partial body, failed allocation, timeout or dropped future retires the stream. The callback must consume and validate the entire body before succeeding.

Source

pub fn reset(&mut self)

Retire a stream whose outstanding request may have been cancelled.

Source

pub async fn close(self)

Trait Implementations§

Source§

impl Drop for AccessoryWorker

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.