num-derive icon indicating copy to clipboard operation
num-derive copied to clipboard

num-derive doesn't know how to handle newtypes with named fields yet.

Open zRegle opened this issue 1 year ago • 3 comments

I'm using bindgen to create a enum, here is the generated code.

#[repr(u32)]
#[non_exhaustive]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, FromPrimitive)]
pub enum Code {
    kSuccess = 0,
    kFailed = 1,
    kHasMore = 2,
    ... // more types
}

And I got this compile error:

#[derive(Debug, Copy, Clone, FromPrimitive)
                             ^^^^^^^^^^^^^
help: message: num-derive doesn't know how to handle newtypes with named fields yet. Please use a tuple-style nentype, or submit a PR!

num-derive version: 0.3.3

Can anyone give me some advice? Thx in advance!

zRegle avatar Feb 04 '24 11:02 zRegle