Closed tsheinen closed 1 year ago
I wanted this for myself and I think this display impl is general enough to be useful built-in?
#[derive(EnumSetType, Debug)] pub enum DisplayEnum { A, B, C, D } impl core::fmt::Display for DisplayEnum { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", match self { DisplayEnum::A => "A", DisplayEnum::B => "B", DisplayEnum::C => "C", DisplayEnum::D => "D", })?; Ok(()) } } #[test] fn test_display() { let target = DisplayEnum::A | DisplayEnum::B | DisplayEnum::D; assert_eq!(format!("{}", target), "(A | B | D)"); }
I will implement this, but am rejecting the pull request.
I wanted this for myself and I think this display impl is general enough to be useful built-in?