paholg/subenum

Support parent-only proc-macros

Opened this issue · 0 comments

paholg commented

Fixing #15 revealed another issue with documentation: We cannot have documentation on the parent separate from the child.

We can already provide documentation on the child only (thanks to #21), but the parent's documentation also shows up.

Example:

/// Enum Foo
#[subenum(Bar(doc = "Enum Bar"))]
pub enum Foo {
    /// Variant A of Foo
    #[subenum(Bar(doc = "Variant A of Bar"))]
    A,
    /// Variant B of Foo
    B,
}

Will result in the following definition of Bar:

///Enum Bar
/// Enum Foo
pub enum Bar {
    ///Variant A of Bar
    /// Variant A of Foo
    A,
}

Perhaps we should solve this in a more general way; we already have subenum-specific proc-macros, also allowing parent-specific ones would do it.