1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
pub mod destructor; pub use self::destructor::Destructor; pub mod input; pub use self::input::Input; pub mod output; pub use self::output::Output; #[doc(hidden)] pub mod common; pub enum Context { Input(Input), Output(Output), } unsafe impl Send for Context {} impl Context { pub fn is_input(&self) -> bool { if let Context::Input(..) = *self { true } else { false } } pub fn input(self) -> Input { if let Context::Input(context) = self { return context; } unreachable!(); } pub fn is_output(&self) -> bool { if let Context::Output(..) = *self { true } else { false } } pub fn output(self) -> Output { if let Context::Output(context) = self { return context; } unreachable!(); } }