Library for displaying Option
s to user without unnecessary conversions and allocations.
use show_option::prelude::*;
println!("received bytes: {}", None::<usize>.show_or("none")); // "received bytes: none"
println!("received: {}", Some(20).show_suffixed_or(" bytes", "none")); // "received: 20 bytes"
println!("amount: {}", Some(20).show_prefixed_or("$", "-")); // "amount: $20"
println!("amount: {}", format_option!(Some(20), "${}", "-")); // "amount: $20"
Repository: GitHub - kriomant/show-option: Rust library for displaying Option's
Documentation: show_option - Rust