Line | Count | Source |
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 | ||
18 | 9.42M | fn deref(&self) -> &Self::Target { |
19 | 9.42M | if self.ok { |
20 | 9.41M | &Failure { fail: false } |
21 | } else { | |
22 | 14.3k | &Failure { fail: true } |
23 | } | |
24 | 9.42M | } |
25 | } |