primitives/
static_bool.rs

1// Copyright 2020 Conflux Foundation. All rights reserved.
2// Conflux is free software and distributed under GNU General Public License.
3// See http://www.gnu.org/licenses/
4
5// General static bool value for compile time flag optimization.
6pub trait StaticBool {
7    fn value() -> bool;
8}
9
10pub struct No {}
11pub struct Yes {}
12
13impl StaticBool for No {
14    fn value() -> bool { false }
15}
16
17impl StaticBool for Yes {
18    fn value() -> bool { true }
19}