pub struct TerminateOnDrop<O: OutputStream> { /* private fields */ }Expand description
A wrapper that automatically terminates a process when dropped.
§Safety Requirements
WARNING: This type requires a multithreaded tokio runtime to function correctly!
§Usage Guidelines
This type should only be used when:
- Your code is running in a multithreaded tokio runtime.
- Automatic process cleanup on drop is absolutely necessary.
§Recommended Alternatives
Instead of relying on automatic termination, prefer these safer approaches:
- Manual process termination using
ProcessHandle::terminate - Awaiting process completion using
ProcessHandle::wait_for_completion - Awaiting process completion or performing an explicit termination using
ProcessHandle::wait_for_completion_or_terminate
§Implementation Details
The drop implementation tries to terminate the process if it was neither awaited nor terminated before being dropped. If termination fails, a panic is raised.
Methods from Deref<Target = ProcessHandle<O>>§
Trait Implementations§
Source§impl<O: Debug + OutputStream> Debug for TerminateOnDrop<O>
impl<O: Debug + OutputStream> Debug for TerminateOnDrop<O>
Source§impl<O: OutputStream> Deref for TerminateOnDrop<O>
impl<O: OutputStream> Deref for TerminateOnDrop<O>
Source§impl<O: OutputStream> Drop for TerminateOnDrop<O>
impl<O: OutputStream> Drop for TerminateOnDrop<O>
Auto Trait Implementations§
impl<O> Freeze for TerminateOnDrop<O>where
O: Freeze,
impl<O> !RefUnwindSafe for TerminateOnDrop<O>
impl<O> Send for TerminateOnDrop<O>where
O: Send,
impl<O> Sync for TerminateOnDrop<O>where
O: Sync,
impl<O> Unpin for TerminateOnDrop<O>where
O: Unpin,
impl<O> !UnwindSafe for TerminateOnDrop<O>
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