use std::fs::File;
use std::sync::Arc;
#[derive(Debug, Default, Clone)]
#[non_exhaustive]
pub enum Redirection {
#[default]
Capture,
Inherit,
Null,
File(Arc<File>),
}
impl Redirection {
pub fn file(f: File) -> Self {
Self::File(Arc::new(f))
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn default_is_capture() {
match Redirection::default() {
Redirection::Capture => {}
_ => panic!("default should be Capture"),
}
}
#[test]
fn variants_are_constructible() {
let _ = Redirection::Capture;
let _ = Redirection::Inherit;
let _ = Redirection::Null;
}
}