pub struct AccessoryWorker {
pub child: Child,
/* private fields */
}Fields§
§child: ChildImplementations§
Source§impl AccessoryWorker
impl AccessoryWorker
Sourcepub fn new(child: Child) -> Result<Self>
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.
Sourcepub fn new_independent(child: Child) -> Result<Self>
pub fn new_independent(child: Child) -> Result<Self>
COM imports own the private Regain worker, not vendor helpers it launches.
pub async fn request(&mut self, request: Value) -> Result<Value>
Sourcepub async fn collect_json_with_timeout<T: DeserializeOwned>(
self,
request: Value,
deadline: Duration,
) -> Result<Collected<T>>
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.
pub async fn request_with_timeout( &mut self, request: Value, deadline: Duration, ) -> Result<Value>
Sourcepub async fn request_typed_with_timeout<T: DeserializeOwned>(
&mut self,
request: Value,
deadline: Duration,
) -> Result<T>
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.
Sourcepub 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>>,
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.