1use core::marker::Destruct;
7
8use std::process::{
10 ExitCode,
11 Termination
12};
13
14
15pub struct Act<Type> {
21 option: Option<Type>
22}
23
24impl Termination for Act<()> {
26 fn report(self) -> ExitCode {return match self.option {
27 None => ExitCode::FAILURE,
28 Some(()) => ExitCode::SUCCESS
29 }}
30}
31
32const impl<Type: [const] Destruct> Act<Type> {
34 #[inline]
35 pub fn map<Return, Closure: [const] FnOnce(Type) -> Return + [const] Destruct>(self, closure: Closure) -> Act<Return> {return Act {
36 option: self.option.map(closure)
37 }}
38 #[inline]
39 pub fn value(self) -> Option<Type> {return self.option}
40}