From 1c666c7e6e37254959e62c94f83f1f4b5451cf3d Mon Sep 17 00:00:00 2001 From: Mossa Date: Sun, 9 May 2021 23:21:08 +0200 Subject: [PATCH] Query on Trait-object doesn't work still. --- examples/query_traits.rs | 23 ----------------------- examples/query_traits.rs_ | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 23 deletions(-) delete mode 100644 examples/query_traits.rs create mode 100644 examples/query_traits.rs_ diff --git a/examples/query_traits.rs b/examples/query_traits.rs deleted file mode 100644 index 4567918..0000000 --- a/examples/query_traits.rs +++ /dev/null @@ -1,23 +0,0 @@ -// -// TODO: This example showcases querying entities on trait implementations -// in bevy. Is this possible? - -use bevy::prelude::*; -use std::fmt::Debug; - -pub trait DebugComponent: Debug + Send + Sync {} - -fn main() { - let mut miniworld = World::new(); - let entity_id = miniworld.spawn().insert(432).id(); - - fn my_system(query: Query<(Box,)>) { - query.for_each(|x| { - dbg!(x); - }); - } - - let mut some_stage = SystemStage::single(my_system.system()); - - some_stage.run(miniworld); -} diff --git a/examples/query_traits.rs_ b/examples/query_traits.rs_ new file mode 100644 index 0000000..6156bc1 --- /dev/null +++ b/examples/query_traits.rs_ @@ -0,0 +1,23 @@ +// +// TODO: This example showcases querying entities on trait implementations +// in bevy. Is this possible? + +use bevy::prelude::*; +use std::fmt::Debug; + +pub trait DebugComponen t: bevy::ecs::component::Component + Debug + ?Sized {} + +fn main() { + let mut mini_world = World::new(); + let entity_id = mini_world.spawn().insert(432).id(); + + fn my_system(query: Query<&dyn DebugComponent>) { + query.for_each(|x| { + // dbg!(x); + }); + } + + let mut some_stage = SystemStage::single(my_system.system()); + + some_stage.run(&mut mini_world); +}