andersk / enum_primitive-rs

Macro to generate num::FromPrimitive instances for enum that works in Rust 1.0
MIT License
63 stars 22 forks source link

enum_primitive! doesn't work in combination with custom_derive! #7

Open norru opened 8 years ago

norru commented 8 years ago
enum_from_primitive! {
custom_derive! {
    #[derive(Debug, Eq, PartialEq, Hash, Copy, Clone, IterVariants(AgentTypeVariants))]
    pub enum AgentType {
        Minion ,
        Spore,
        Player,
        FriendlyBullet,
        Enemy,
        EnemyBullet,
        Resource,
        Prop,
    }
}
}

fails with

src/backend/world/mod.rs:21:1: 21:14 error: no rules expected the token `custom_derive`
src/backend/world/mod.rs:21 custom_derive! {
cardoe commented 7 years ago

fwiw, https://crates.io/crates/enum-primitive-derive should work in that case a bit better.