use edict::{component::Component, world::World};
#[derive(Debug, PartialEq, Eq, Component)]
struct Foo;
#[derive(Debug, PartialEq, Eq, Component)]
struct Bar;
#[derive(Debug, PartialEq, Eq, Component)]
struct Baz;
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Default, Component)]
#[edict(where T: 'static)]
struct Value<T>(T);
fn main() {
let mut world = World::new();
let e = world.spawn((Foo, Bar, Baz));
assert!(matches!(e.get::<&Foo>(), Some(&Foo)));
let e = e.insert(Value(0u32)).unwrap();
assert!(matches!(e.get::<&Value<u32>>(), Some(&Value(0))));
let e = e.insert(Value(1u32)).unwrap();
assert!(matches!(e.get::<&Value<u32>>(), Some(&Value(1))));
let e = e.insert_bundle((Value(1u8), Value(2u16))).unwrap();
e.despawn();
let _ = world.spawn((Foo, Bar));
let _entities: Vec<_> = world.spawn_batch((0..10u32).map(|i| (Value(i),))).collect();
let _entities: Vec<_> = world
.spawn_batch((0u32..).map(|i| (Value(i),)))
.take(10)
.collect();
}