use std::mem;
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
pub enum ExitStatus {
Exited(u32),
Signaled(u8),
Other(i32),
Undetermined,
}
impl ExitStatus {
pub fn success(&self) -> bool {
if let &ExitStatus::Exited(0) = self {
true
} else {
false
}
}
}
#[derive(Debug, Copy, Clone)]
#[allow(dead_code)]
pub enum StandardStream {
Input,
Output,
Error,
}
#[derive(Debug)]
pub struct Undropped<T>(Option<T>);
impl<T> Undropped<T> {
pub unsafe fn new(o: T) -> Undropped<T> {
Undropped(Some(o))
}
pub fn get_ref(&self) -> &T {
self.0.as_ref().unwrap()
}
}
impl<T> Drop for Undropped<T> {
fn drop(&mut self) {
let o = self.0.take().unwrap();
mem::forget(o);
}
}