pub struct ProcessSubscription<M: Send + 'static> { /* private fields */ }Expand description
A subscription that spawns and monitors an external process.
Captures stdout/stderr line-by-line and sends ProcessEvent messages.
The process is killed when the subscription’s StopSignal fires or
when the optional timeout expires.
Implementations§
Source§impl<M: Send + 'static> ProcessSubscription<M>
impl<M: Send + 'static> ProcessSubscription<M>
Sourcepub fn new(
program: impl Into<String>,
make_msg: impl Fn(ProcessEvent) -> M + Send + Sync + 'static,
) -> Self
pub fn new( program: impl Into<String>, make_msg: impl Fn(ProcessEvent) -> M + Send + Sync + 'static, ) -> Self
Create a new process subscription for the given program.
The make_msg closure converts ProcessEvent into your model’s
message type.
Sourcepub fn args(self, args: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn args(self, args: impl IntoIterator<Item = impl Into<String>>) -> Self
Add multiple command-line arguments.
Sourcepub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
Set an environment variable for the child process.
Trait Implementations§
Auto Trait Implementations§
impl<M> Freeze for ProcessSubscription<M>
impl<M> !RefUnwindSafe for ProcessSubscription<M>
impl<M> Send for ProcessSubscription<M>
impl<M> Sync for ProcessSubscription<M>
impl<M> Unpin for ProcessSubscription<M>
impl<M> UnsafeUnpin for ProcessSubscription<M>
impl<M> !UnwindSafe for ProcessSubscription<M>
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
Mutably borrows from an owned value. Read more