Skip to content

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

@zRegle

Description

@zRegle

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions