pub struct SidecarManager { /* private fields */ }Expand description
Supervises one sidecar process and its line-JSON streams.
Construct via SidecarManager::spawn; drive with [press],
[release], [shutdown]. Receive events with [next_event].
Implementations§
Source§impl SidecarManager
impl SidecarManager
Sourcepub async fn spawn(
bin: &Path,
args: &[String],
config: Value,
) -> Result<Self, SidecarError>
pub async fn spawn( bin: &Path, args: &[String], config: Value, ) -> Result<Self, SidecarError>
Spawn bin with args, wait for Hello, send Init, and start
the background reader task. Hello is readiness; no post-Init status
is required. Hello has a 10s deadline and command writes have a 2s
deadline. Cancelling startup drops the child and reader tasks.
Sourcepub fn ready_after_init(&self) -> bool
pub fn ready_after_init(&self) -> bool
Optional initialization contract. Without it Hello+Init is the legacy protocol-ready boundary, not proof that model/device loading finished.
Sourcepub fn try_next_event(&mut self) -> Option<SidecarLifecycleEvent>
pub fn try_next_event(&mut self) -> Option<SidecarLifecycleEvent>
Nonblocking drain for hosts about to publish readiness or activate.
Sourcepub async fn press(&mut self) -> Result<(), SidecarError>
pub async fn press(&mut self) -> Result<(), SidecarError>
Send a trigger press command.
Sourcepub async fn release(&mut self) -> Result<(), SidecarError>
pub async fn release(&mut self) -> Result<(), SidecarError>
Send a trigger release command.
Sourcepub async fn shutdown(&mut self) -> Result<(), SidecarError>
pub async fn shutdown(&mut self) -> Result<(), SidecarError>
Send a graceful shutdown command and reap the child process.
A write error is returned only after cleanup; an already closed input
still permits cleanup and repeated shutdown calls.
Sourcepub async fn next_event(&mut self) -> Option<SidecarLifecycleEvent>
pub async fn next_event(&mut self) -> Option<SidecarLifecycleEvent>
Receive the next high-level event, or None if the channel
closed (sidecar exited and reader task drained).
Trait Implementations§
Source§impl Drop for SidecarManager
impl Drop for SidecarManager
Auto Trait Implementations§
impl !RefUnwindSafe for SidecarManager
impl !UnwindSafe for SidecarManager
impl Freeze for SidecarManager
impl Send for SidecarManager
impl Sync for SidecarManager
impl Unpin for SidecarManager
impl UnsafeUnpin for SidecarManager
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.