1 use core::ops::Deref;
2 
3 pub const OK: Success = Success { ok: true };
4 pub const FAIL: Success = Success { ok: false };
5 
6 #[must_use]
7 pub struct Success {
8     pub ok: bool,
9 }
10 
11 pub struct Failure {
12     pub fail: bool,
13 }
14 
15 impl Deref for Success {
16     type Target = Failure;
17 
deref(&self) -> &Self::Target18     fn deref(&self) -> &Self::Target {
19         if self.ok {
20             &Failure { fail: false }
21         } else {
22             &Failure { fail: true }
23         }
24     }
25 }
26