Expand description
Kleene logic within Rust’s type system
Values are True
, False
and Unknown
. Operations are Not
, BitAnd
and BitOr
from std::ops
. There is also the Ternary
enum which
represents the values at runtime and the ToTernary
trait that adds the
to_ternary()
methods to our value types.
Examples:
Same
and Not
type NotTrue = <<True as Not>::Output as Same<False>>::Output;
type NotFalse = <<False as Not>::Output as Same<True>>::Output;
type NotUnknown = <<Unknown as Not>::Output as Same<Unknown>>::Output;
Transforming Values to Runtime, BitAnd
and BitOr
assert_eq!(Ternary::T, <True as BitOr<<Unknown as BitAnd<False>>::Output>>::Output::to_ternary());
Enums§
- False
- Our False type value
- Ternary
- runtime representation
- True
- Our True type value
- Unknown
- Our Unknown type value