1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! boolから"Yes"/"No"への変換

pub trait YesNo {
    /// `true`->`"Yes"`, `false`->`"No"` に変換
    fn yesno(&self) -> String;
}

impl YesNo for bool {
    fn yesno(&self) -> String {
        if *self {
            "Yes".to_string()
        } else {
            "No".to_string()
        }
    }
}