Skip to content

Allow doc comments for generated type from EnumDiscriminants #140

@linclelinkpart5

Description

@linclelinkpart5

I'd love to be able to provide doc comments for the generated discriminants enum. I have a working local fork of strum, with the changes needed for this to work, which lets you do something like this:

use strum_macros::EnumDiscriminants;

#[derive(Debug, EnumDiscriminants)]
#[strum_discriminants(doc("Doc comment for the new enum."))]
#[strum_discriminants(doc("Split it into multiple lines if needed."))]
enum SourceEnum {
    Variant0(bool),
    Variant1(i32),
}

This would generate a discriminants enum that looks something like this (derives omitted for brevity):

#[doc = "Doc comment for the new enum."]
#[doc = "Split it into multiple lines if needed."]
enum SourceEnumDiscriminants {
    Variant0,
    Variant1,
}

If this looks good, I'd be happy to author a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions