1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::fmt;

pub struct YesNo(pub bool);

impl fmt::Display for YesNo {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        (if self.0 { "Yes" } else { "No" }).fmt(f)
    }
}

#[test]
fn sanity_check() {
    assert_eq!(format!("{}", YesNo(true)), "Yes");
    assert_eq!(format!("{}", YesNo(false)), "No");
}