libikarus 0.1.14

The core functionality of Ikarus wrapped neatly in a rust library
Documentation
pub trait BoolToResult {
    fn false_or<E>(&self, e: E) -> Result<(), E>;
    fn true_or<E>(&self, e: E) -> Result<(), E>;
}

impl BoolToResult for bool {
    fn false_or<E>(&self, e: E) -> Result<(), E> {
        if *self {
            Err(e)
        } else {
            Ok(())
        }
    }

    fn true_or<E>(&self, e: E) -> Result<(), E> {
        if *self {
            Ok(())
        } else {
            Err(e)
        }
    }
}