Skip to main content

PluginHostProcess

Struct PluginHostProcess 

Source
pub struct PluginHostProcess { /* private fields */ }
Expand description

Manages a plugin running in an isolated process.

Responses are read on a background thread and delivered over a channel, so Self::send_command can wait with a deadline: a hung plugin yields a timeout error (and the child is killed) instead of blocking the host forever, and a crashed helper surfaces as a disconnect error rather than a silent wedge.

Implementations§

Source§

impl PluginHostProcess

Source

pub fn new( helper_override: Option<PathBuf>, timeout: Duration, ) -> Result<Self, String>

Create a new isolated plugin host process

Source

pub fn set_timeout(&mut self, timeout: Duration)

Set how long to wait for a helper response before declaring a timeout.

Source

pub fn send_command( &mut self, command: HostCommand, ) -> Result<HostResponse, String>

Send a command to the helper process and wait (with a deadline) for a response.

Returns an error without blocking indefinitely if the plugin hangs (the child is killed) or the helper has crashed/exited.

Source

pub fn is_alive(&self) -> bool

Whether the helper process is still considered alive.

Source

pub fn helper_pid(&self) -> Option<u32>

OS process id of the running helper, if any. Useful for monitoring — and for tests that need to simulate a crash by killing the helper.

Source

pub fn check_process_status(&mut self) -> Result<(), String>

Check if the helper process is still running

Source

pub fn shutdown(&mut self)

Shutdown the helper process

Trait Implementations§

Source§

impl Drop for PluginHostProcess

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

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.