From 808322ecbb61e890a059a9b8fb51539af33cd97c Mon Sep 17 00:00:00 2001 From: Louis Capitanchik <contact@louiscap.co> Date: Sun, 25 Feb 2024 01:06:44 +0000 Subject: [PATCH] Update to Bevy 0.13 --- Cargo.toml | 6 +++--- README.md | 1 + rustfmt.toml | 3 +++ src/lib.rs | 27 +++++++++++++++------------ 4 files changed, 22 insertions(+), 15 deletions(-) create mode 100644 rustfmt.toml diff --git a/Cargo.toml b/Cargo.toml index 7746f28..47584bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "micro_bevy_world_utils" -version = "0.3.0" +version = "0.4.0" edition = "2021" license = "Apache-2.0" description = "Handy, reusable utilities for working with direct world access in a Bevy exclusive system" @@ -11,5 +11,5 @@ repository = "https://lab.lcr.gr/microhacks/micro-bevy-world-utils" [dependencies] -bevy_ecs = "0.11.0" -bevy_hierarchy = "0.11.0" +bevy_ecs = "0.13" +bevy_hierarchy = "0.13" diff --git a/README.md b/README.md index 5e74b6b..ec5b1ce 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ the given entities, the result will be `None` | world_utiles ver | bevy ver | |------------------|----------| +| 0.4 | 0.13 | | 0.3 | 0.11 | | 0.2 | 0.10 | | 0.1 | 0.9 | \ No newline at end of file diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..2b6f66e --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,3 @@ +hard_tabs = true +use_field_init_shorthand = true +use_try_shorthand = true \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 01f0cc7..cc11f6a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,10 +30,10 @@ //! - `get_left_right_any_parent`: Match entities to the left and right components, but return the _parent_ entity of the right entity //! use bevy_ecs::{ - component::Component, + component::Component, entity::Entity, event::EventWriter, - query::{With, ReadOnlyWorldQuery}, + query::{QueryFilter, With}, system::{Query, SystemState}, world::World, }; @@ -44,8 +44,8 @@ pub type Right = Entity; pub type SortedEntities = (Left, Right); fn inner_get_left_right_entities< - LeftSide: ReadOnlyWorldQuery + 'static, - RightSide: ReadOnlyWorldQuery + 'static, + LeftSide: QueryFilter + 'static, + RightSide: QueryFilter + 'static, >( world: &mut World, first: &Entity, @@ -64,9 +64,9 @@ fn inner_get_left_right_entities< } fn inner_get_left_right_parent_entities< - LeftSide: ReadOnlyWorldQuery + 'static, - RightSide: ReadOnlyWorldQuery + 'static, - ParentSide: ReadOnlyWorldQuery + 'static, + LeftSide: QueryFilter + 'static, + RightSide: QueryFilter + 'static, + ParentSide: QueryFilter + 'static, >( world: &mut World, first: &Entity, @@ -98,10 +98,10 @@ fn inner_get_left_right_parent_entities< } fn inner_get_left_parent_right_parent_entities< - LeftSide: ReadOnlyWorldQuery + 'static, - LeftParent: ReadOnlyWorldQuery + 'static, - RightSide: ReadOnlyWorldQuery + 'static, - RightParent: ReadOnlyWorldQuery + 'static, + LeftSide: QueryFilter + 'static, + LeftParent: QueryFilter + 'static, + RightSide: QueryFilter + 'static, + RightParent: QueryFilter + 'static, >( world: &mut World, first: &Entity, @@ -240,7 +240,10 @@ pub fn get_any_left_parent_any_right_parent_entities< /// send_event(world, MyEventType { message: 1234 }); /// } /// ``` -pub fn send_event<Event: bevy_ecs::event::Event + Sync + Send + 'static>(world: &mut World, event: Event) { +pub fn send_event<Event: bevy_ecs::event::Event + Sync + Send + 'static>( + world: &mut World, + event: Event, +) { SystemState::<EventWriter<Event>>::new(world) .get_mut(world) .send(event); -- GitLab