| 12 | |
| 13 | #[async_trait] |
| 14 | pub trait LifecycleHandler: Send { |
| 15 | /// Called after the child process has been spawned, allowing the current process to send state |
| 16 | /// to the child process. The child process can receive this data by calling |
| 17 | /// `receive_from_old_process`. |
| 18 | async fn send_to_new_process(&mut self, _write_pipe: PipeWriter) -> io::Result<()> { |
| 19 | Ok(()) |
| 20 | } |
| 21 | |
| 22 | /// Called before the child process has been spawned. |
| 23 | async fn pre_new_process(&mut self) {} |
| 24 | |
| 25 | /// Called after `send_to_new_process` if the child process fails to start successfully. |
| 26 | /// This gives you an opportunity to undo any state changes made in `send_to_new_process`. |
| 27 | async fn new_process_failed(&mut self) {} |
| 28 | } |
| 29 | |
| 30 | /// A default implementation of LifecycleHandler that does nothing in response to lifecycle events. |
| 31 | pub struct NullLifecycleHandler; |
no outgoing calls
no test coverage detected