settings

Macro generate_inspect_with_info

Source
macro_rules! generate_inspect_with_info {
    ($(#[$metas:meta])* pub enum $name:ident {
        $(
            $(#[doc = $str:expr])*
            $(#[cfg($test:meta)])?
            $variant:ident ( $data:ty )
        ),* $(,)?
    }
    ) => { ... };
}
Expand description

This macro takes an enum, which has variants associated with exactly one data, and generates the same enum and implements a for_inspect method. The for_inspect method returns variants’ names and formated data contents.