Skip to main content

display_via_debug

Macro display_via_debug 

Source
macro_rules! display_via_debug {
    ($ty:ty) => { ... };
}
Expand description

Implement std::fmt::Display for a type by delegating to its std::fmt::Debug impl.

Useful for simple enums that #[derive(Debug)] and need no custom Display.

ยงExample

#[derive(Debug)]
enum Color { Red, Green, Blue }

vers3::display_via_debug!(Color);
assert_eq!(format!("{}", Color::Red), "Red");