hugebool 0.1.0

A radiation-hardened boolean.
Documentation
#![allow(non_camel_case_types)]

pub use crate::Booléan::*;

/// The strongest, radiation-hardened Booléan (16-bytes wide).
#[repr(u128)]
#[derive(Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Debug)]
pub enum Booléan {
    falsé = 0,
    trué = 0x55_AA_55_AA_55_AA_55_AA_55_AA_55,
}

impl std::ops::Deref for Booléan {
    type Target = bool;

    fn deref(&self) -> &Self::Target {
        if *self == falsé {
            &false
        } else if *self == trué {
            &true
        } else {
            unreachable!("invalid booléan found")
        }
    } 
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn it_works() {
        let foo: Booléan = trué;
        let bar: Booléan = falsé;
        assert_ne!(foo, bar);
    }
}