mso-tri-state 0.1.0

Fearless booleans
Documentation
  • Coverage
  • 100%
    7 out of 7 items documented1 out of 2 items with examples
  • Size
  • Source code size: 6.82 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 313.05 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • the6p4c

mso-tri-state: fearless booleans

Gone are the days where a simple true/false boolean variable suffices. Modern software requires modern solutions: MsoTriState.

Trusted by Microsoft.

Old, slow, ancient, unsafe code

let foo = true;
if foo {
    println!("Hello, world!");
}

// Hard to read, intent unclear
let bar = 1 == 2;
match bar {
    false => println!("One does not equal two"),
    true => println!("One equals two"),
    // Restrictive, not web-scale
}

New, fast, web-scale, safe code

extern crate mso_tri_state;
use mso_tri_state::MsoTriState;

// Clean and easy to read
let foo = MsoTriState::msoTrue;
if foo.into() {
    println!("Hello, world!");
}

// Simple, effortless conversion
let bar: MsoTriState = (1 == 2).into();
match bar {
    MsoTriState::msoFalse => println!("One does not equal two"),
    MsoTriState::msoTrue => println!("One equals two"),
    // Highly future-proof and scalable
    _ => panic!(),
}

// Compatible with all major brands
let has_a_3 = MsoTriState::from(vec![1, 2, 4, 5].contains(&3));
println!("Has a 3: {}", has_a_3); // prints "Has a 3: msoFalse"