3 releases (1 stable)

1.0.0 Apr 26, 2024
0.1.1 Apr 26, 2024
0.1.0 Apr 26, 2024

#761 in Rust patterns

21 downloads per month

MIT/Apache

7KB

materially

Build Status API reference Crates.io License

A macro for material implication.

a => b ("a implies b") means !a || b.

Examples

use materially::implies as i;

assert!(i!(false => true));
assert!(i!(false => false));
assert!(i!(true => true));
assert!(!i!(true => false));

// Implication is right-associative
assert!(i!(false => false => false));

// let-chains style syntax is also supported
assert!(i!(let Some(a) = Some(17) => a > 3 => let None = Some(17) => false));

lib.rs:

A macro for material implication.

a => b ("a implies b") means !a || b.

Examples

use materially::implies as i;

assert!(i!(false => true));
assert!(i!(false => false));
assert!(i!(true => true));
assert!(!i!(true => false));

// Implication is right-associative
assert!(i!(false => false => false));

// let-chains style syntax is also supported
assert!(i!(let Some(a) = Some(17) => a > 3 => let None = Some(17) => false));

No runtime deps