Ralith / hecs

A handy ECS
Apache License 2.0
924 stars 81 forks source link

problem with macro 'Bundle' #304

Closed Randommist closed 1 year ago

Randommist commented 1 year ago

My code: """ use hecs::Bundle;

[derive(Bundle)]

struct Foo { x: i32, y: char, }

fn main() { let mut world = World::new(); let e = world.spawn(Foo { x: 42, y: 'a' }); assert_eq!(*world.get::<&i32>(e).unwrap(), 42); } """ I have errors: error: cannot find derive macro Bundle in this scope --> src/main.rs:2:10 2 #[derive(Bundle)] ^^^^^^

note: Bundle is imported here, but it is only a trait, without a derive macro --> src/main.rs:1:5 | 1 | use hecs::Bundle; | ^^^^^^^^^^^^

Ralith commented 1 year ago

You need to enable the macros feature: https://github.com/Ralith/hecs/blob/122cb6aa682bf4cae7e646109608ac4e97df9b4d/Cargo.toml#L24-L25