mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-04 02:39:32 +00:00
Refactor out JodChild
This commit is contained in:
parent
1347b7fa4c
commit
54eb87de03
4 changed files with 25 additions and 23 deletions
|
@ -1,5 +1,5 @@
|
|||
//! Missing batteries for standard libraries.
|
||||
use std::time::Instant;
|
||||
use std::{ops, process, time::Instant};
|
||||
|
||||
mod macros;
|
||||
pub mod panic_context;
|
||||
|
@ -147,6 +147,27 @@ where
|
|||
left
|
||||
}
|
||||
|
||||
pub struct JodChild(pub process::Child);
|
||||
|
||||
impl ops::Deref for JodChild {
|
||||
type Target = process::Child;
|
||||
fn deref(&self) -> &process::Child {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl ops::DerefMut for JodChild {
|
||||
fn deref_mut(&mut self) -> &mut process::Child {
|
||||
&mut self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for JodChild {
|
||||
fn drop(&mut self) {
|
||||
let _ = self.0.kill();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue