Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/llogiq/ternary
Kleene logic in Rust's type system
https://github.com/llogiq/ternary
Last synced: 8 days ago
JSON representation
Kleene logic in Rust's type system
- Host: GitHub
- URL: https://github.com/llogiq/ternary
- Owner: llogiq
- License: mit
- Created: 2015-12-17T19:37:58.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-26T23:11:22.000Z (almost 9 years ago)
- Last Synced: 2024-11-14T05:49:43.424Z (about 1 month ago)
- Language: Rust
- Size: 525 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kleene logic within Rust's type system
[![Build Status](https://travis-ci.org/llogiq/ternary.svg)](https://travis-ci.org/llogiq/ternary)
[![Current Version](http://meritbadge.herokuapp.com/ternary)](https://crates.io/crates/ternary)
[![Coverage Status](https://coveralls.io/repos/github/llogiq/ternary/badge.svg?branch=master)](https://coveralls.io/github/llogiq/ternary?branch=master)
[![License: MIT/Apache](https://img.shields.io/crates/l/ternary.svg)](LICENSE)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](http://llogiq.github.io/ternary)
Examples:
`Same` and `Not`
```
use ternary::{True, False, Unknown, Same};
use std::ops::Not;
type NotTrue = <::Output as Same>::Output;
type NotFalse = <::Output as Same>::Output;
type NotUnknown = <::Output as Same>::Output;
```Transforming Values to Runtime, `BitAnd` and `BitOr`
```
assert_eq!(Ternary::T, >::Output>>::Output::to_ternary());
```To use it, add `ternary = "0.1.0"` to your dependencies.