macro_rules! derive_display_from_serialize {
    ($type:ident $(:: $type_extra:ident)* < $($lt:lifetime),+ >) => { ... };
    ($type:ty) => { ... };
}
Expand description

Implements Display for a type that forwards to Serialize.

use serde::Deserialize;
use serde_plain::derive_display_from_serialize;

#[derive(Serialize, Debug)]
pub enum MyEnum {
    VariantA,
    VariantB,
}

derive_display_from_serialize!(MyEnum);

This automatically implements Display which will invoke the to_string method from this crate. In case that fails the method will panic.