flagset icon indicating copy to clipboard operation
flagset copied to clipboard

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

Open EndilWayfare opened this issue 3 years ago • 0 comments

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.

EndilWayfare avatar Oct 22 '21 03:10 EndilWayfare