imply_option 0.1.2

Provides a single `trait` which allows the construction of an `Option` based on a bool value.
Documentation
  • Coverage
  • 100%
    4 out of 4 items documented1 out of 4 items with examples
  • Size
  • Source code size: 1.93 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 134.91 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Dynisious/imply_option
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Dynisious

An implementation of this RFC.

Provides a single trait which allows the construction of an Option based on a bool value.

extern crate imply_option;

use imply_option::*;

fn main() {
let pass = true;

assert_eq!(pass.then(1), Some(1));
assert_eq!(pass.then_do(|| 1), Some(1));

let fail = false;

assert_eq!(fail.then(1), None);
}