type_level_logic/types/
boolean.rs

1//! Type-level booleans.
2
3type_operators! {
4    [A, B, C, D, E]
5
6    /// The `True` type reifies to `true` (as you might expect) and the `False` type reifies to
7    /// `false`. If the crate is compiled with the `specialization` feature turned on, then an
8    /// `Error` type is also present. When reified, the `Error` type panics with an error message
9    /// explaining that the only way an `Error` type can be introduced into type-level boolean
10    /// logic is through a non-`Bool` type being used. If `specialization` is on, a default
11    /// implementation is also generated for *all* types. When `reify` is called on this default
12    /// implementation, it panics with an error message explaining that the type is not a `Bool`.
13    concrete Bool => bool {
14        False => false,
15        True => true,
16        #[cfg(feature = "specialization")]
17        Error => panic!("Error: An unexpected, non-Bool type has been introduced into type-level boolean logic!"),
18        #[cfg(feature = "specialization")]
19        DEFAULT => panic!("Error: This is not a Bool!"),
20    }
21}