Skip to content

Documentation inaccurate? #27

Description

@ruckc

I'm trying to use num_derive, but the way I got it working doesn't align to the documentation.

Enum definition:
https://github.com/ruckc/mcr/blob/num_derive/src/igmp/types.rs#L4

Seemingly required use:
https://github.com/ruckc/mcr/blob/num_derive/src/igmp/header.rs#L3

For some reason in the files i'm trying to use the from_u8 function, i have to use crate::num::FromPrimitive and depend on num = "0.2.0" in Cargo.toml`

Without the num crate or use crate::num::FromPrimitive I get this error:

error[E0599]: no variant or associated item named `from_u8` found for type `igmp::types::IgmpType` in the current scope
  --> src/igmp/header.rs:13:19
   |
13 |         IgmpType::from_u8(self.itype)
   |                   ^^^^^^^ variant or associated item not found in `igmp::types::IgmpType`
   |
  ::: src/igmp/types.rs:5:1
   |
5  | pub enum IgmpType {
   | ----------------- variant or associated item `from_u8` not found here
   |
   = help: items from traits can only be used if the trait is in scope
   = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
           `use crate::num::FromPrimitive;`

error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions