[−][src]Derive Macro hecs_macros::Bundle
#[derive(Bundle)]
Implement Bundle
for a struct
Bundles can be passed directly to World::spawn
and World::insert
, and obtained from
World::remove
. Monomorphic Bundle
implementations are slightly more efficient than the
polymorphic implementations for tuples, and can be convenient when combined with other derives
like serde::Deserialize
.
Example
ⓘThis example is not tested
#[derive(Bundle)] struct Foo { x: i32, y: char, } let mut world = World::new(); let e = world.spawn(Foo { x: 42, y: 'a' }); assert_eq!(*world.get::<i32>(e).unwrap(), 42);