Skip to content

Out of date docs? Valueless variants *are* supported; From<$enum> for $integer is *not* impl'd #19

@EndilWayfare

Description

@EndilWayfare

Hey, sweet crate by the way! Soooo glad I don't have to reinvent the wheel on this one.

Unless I'm missing something, a few statements on the flagset::flags doc page seem inaccurate.

Each enumeration value MUST have a specified value.

It looks like // Entry point for enumerations without values has existed since 0.1.0?

It is also worth noting that this macro automatically implements a variety of standard traits including:

  • Copy
  • Clone
    ...
  • From<$enum> for $integer
    ...

From<$enum> for FlagSet<$enum> is the only macro-generated From impl I see.

It's not a huge deal to me personally (I already have bidirectional From impls for non-flag instances generated by a c-style enum bindgen-oxidation macro I'm working on). I was just really confused at the observed behavior until I cracked open the source. I imagine future devs might encounter a similar situation so I figured I'd raise awareness.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions