if_empty 0.3.0

Replace if/else checks for emptyness with a simple method call
Documentation
1
2
3
4
5
6
7
8
use if_empty::*;

fn main() {
    let s = String::default();
    let s_ = "";
    println!("'{}' should be '{}'", s.clone(), s.if_empty("with content".to_string()));
    println!("'{}' -> '{}'", s_, s_.if_empty("not anymore"));
}