Skip to content

Dynisious/imply_option

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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);
}

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages