Skip to main content

show_fieldless_enum_concat_str

Function show_fieldless_enum_concat_str 

Source
fn show_fieldless_enum_concat_str(
    cx: &ExtCtxt<'_>,
    span: Span,
    def: &EnumDef,
    type_ident: Ident,
) -> Option<Box<Expr>>
Expand description

Special case for large enums with no fields. Builds:

impl ::core::fmt::Debug for A {
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_c_like_enum_write_str(f,
            "A B C D E F",
            match self {
                A::A => 0usize,
                A::B => 2usize,
                A::C => 4usize,
                A::D => 6usize,
                A::E => 8usize,
                A::F => 10usize,
            })
    }
}