ternary 0.1.3

Kleene Logic within Rust's type system
Documentation
  • Coverage
  • 83.33%
    10 out of 12 items documented2 out of 8 items with examples
  • Size
  • Source code size: 7.83 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.42 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Documentation
  • llogiq/ternary
    2 0 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • llogiq

Kleene logic within Rust's type system

Build Status Current Version License: MIT

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.

For more information read the API documentation

Examples:

Same and Not

 use ternary::{True, False, Unknown, Same};
 use std::ops::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());

To use it, add ternary = "0.1.0" to your dependencies.