Skip to content

Commit 93586b5

Browse files
authored
Merge pull request #63 from RobWalt/0.14-release-preparation
Release Preparations for bevy 0.14
2 parents 5df9eb3 + e4698de commit 93586b5

File tree

12 files changed

+86
-68
lines changed

12 files changed

+86
-68
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Version 0.6 (Bevy 0.14)
4+
5+
* Added support for Bevy 0.14.
6+
* Added `WithoutAny` filter to check if an entity is not holding any component of a certain trait
7+
* Update `WithOne` to only implement `QueryFilter`. This means it's not usable in the data position anymore. To migrate this change, use `One` instead, which is the intended way of doing that
8+
39
## Version 0.3 (Bevy 0.11)
410

511
* Added support for Bevy 0.11.

Cargo.toml

Lines changed: 18 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,22 @@
1-
[package]
2-
name = "bevy-trait-query"
3-
version = "0.5.1"
4-
edition = "2021"
5-
6-
description = "Implementation of trait queries for the bevy game engine"
7-
repository = "https://github.com/JoJoJet/bevy-trait-query/"
8-
license = "MIT OR Apache-2.0"
9-
keywords = ["bevy", "gamedev", "plugin", "query", "trait"]
10-
categories = ["game-development"]
11-
12-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
13-
14-
[features]
15-
default = ["bevy_app", "bevy_core"]
16-
17-
[dependencies]
18-
bevy-trait-query-impl = { path = "proc-macro", version = "0.5.0" }
1+
[workspace]
2+
resolver = "2"
3+
members = [
4+
"bevy-trait-query",
5+
"bevy-trait-query-impl"
6+
]
7+
8+
[workspace.dependencies]
199
tracing = "0.1"
10+
bevy_ecs = "0.14"
11+
bevy_app = "0.14"
12+
bevy_core = "0.14"
2013

21-
[dependencies.bevy_ecs]
22-
version = "0.14"
23-
24-
[dependencies.bevy_app]
25-
version = "0.14"
26-
optional = true
27-
28-
[dependencies.bevy_core]
29-
version = "0.14"
30-
optional = true
14+
# proc macro
15+
proc-macro2 = "1"
16+
syn = { version = "2", features = ["full"] }
17+
quote = "1"
18+
proc-macro-crate = "1"
3119

32-
[dev-dependencies]
20+
# dev deps
3321
criterion = "0.5"
34-
35-
[dev-dependencies.bevy]
36-
version = "0.14"
37-
default-features = false
38-
39-
[[bench]]
40-
name = "concrete"
41-
harness = false
42-
43-
[[bench]]
44-
name = "all"
45-
harness = false
46-
47-
[[bench]]
48-
name = "one"
49-
harness = false
50-
51-
[[bench]]
52-
name = "fragmented"
53-
harness = false
22+
bevy = { version = "0.14", default-features = false }

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ Before using this crate, you should be familiar with bevy: https://bevyengine.or
66

77
| Bevy Version | [Crate Version](CHANGELOG.md) |
88
|--------------|---------------|
9+
| Preview | Main branch |
10+
| 0.14 | 0.6 |
911
| 0.13 | 0.5 |
1012
| 0.12 | 0.4 |
1113
| 0.11 | 0.3 |
1214
| 0.10 | 0.2 |
1315
| 0.9 | 0.1 |
1416
| 0.8 | 0.0.3 |
15-
| Preview | Main branch |
1617

1718
## Note on reliability
1819

@@ -134,11 +135,11 @@ fn show_tooltips(
134135

135136
The performance of trait queries is quite competitive. Here are some benchmarks for simple cases:
136137

137-
| | Concrete type | One<dyn Trait> | All<dyn Trait> |
138+
| | Concrete type | One<dyn Trait> | All<dyn Trait> |
138139
|-------------------|----------------|-------------------|-----------------|
139-
| 1 match | 16.135 µs | 31.441 µs | 63.273 µs |
140-
| 2 matches | 17.501 µs | - | 102.83 µs |
141-
| 1-2 matches | - | 16.959 µs | 82.179 µs |
140+
| 1 match | 8.395 µs | 28.174 µs | 81.027 µs |
141+
| 2 matches | 8.473 µs | - | 106.47 µs |
142+
| 1-2 matches | - | 14.619 µs | 92.876 µs |
142143

143144
<!-- cargo-rdme end -->
144145

benches/fragmented.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ macro_rules! create_entities {
4444
($world:ident; $( $variants:ident ),*) => {
4545
$(
4646
#[derive(Component)]
47-
struct $variants(f32);
47+
struct $variants { _dummy: f32 }
4848
for _ in 0..20 {
49-
$world.spawn(($variants(0.0), RecA { messages: vec![] }, RecB { messages: vec![] }));
49+
$world.spawn(($variants { _dummy: 0.0 }, RecA { messages: vec![] }, RecB { messages: vec![] }));
5050
}
5151
)*
5252
};

proc-macro/Cargo.toml renamed to bevy-trait-query-impl/Cargo.toml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ license = "MIT OR Apache-2.0"
99
keywords = ["bevy", "gamedev", "plugin", "query", "trait"]
1010
categories = ["game-development"]
1111

12-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
13-
1412
[lib]
1513
proc-macro = true
1614

1715
[dependencies]
18-
proc-macro2 = "1"
19-
syn = { version = "2", features = ["full"] }
20-
quote = "1"
21-
proc-macro-crate = "1"
16+
proc-macro2.workspace = true
17+
syn = { workspace = true, features = ["full"] }
18+
quote.workspace = true
19+
proc-macro-crate.workspace = true
File renamed without changes.

proc-macro/src/lib.rs renamed to bevy-trait-query-impl/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use syn::{parse_quote, ItemTrait, Result, TraitItem};
2222
///
2323
/// Trait queries are often the most *obvious* solution to a problem, but not always the best one.
2424
/// For examples of strong real-world use-cases, check out the RFC for trait queries in `bevy`:
25-
/// https://github.com/bevyengine/rfcs/pull/39.
25+
/// <https://github.com/bevyengine/rfcs/pull/39>.
2626
///
2727
/// # Note
2828
///
@@ -50,7 +50,7 @@ fn impl_trait_query(arg: TokenStream, item: TokenStream) -> Result<TokenStream2>
5050
let trait_name = trait_definition.ident.clone();
5151

5252
// Add `'static` bounds, unless the user asked us not to.
53-
if !no_bounds.is_some() {
53+
if no_bounds.is_none() {
5454
trait_definition.supertraits.push(parse_quote!('static));
5555

5656
for param in &mut trait_definition.generics.params {

bevy-trait-query/Cargo.toml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[package]
2+
name = "bevy-trait-query"
3+
version = "0.5.1"
4+
edition = "2021"
5+
6+
description = "Implementation of trait queries for the bevy game engine"
7+
repository = "https://github.com/JoJoJet/bevy-trait-query/"
8+
license = "MIT OR Apache-2.0"
9+
keywords = ["bevy", "gamedev", "plugin", "query", "trait"]
10+
categories = ["game-development"]
11+
12+
[features]
13+
default = ["bevy_app", "bevy_core"]
14+
15+
[dependencies]
16+
bevy-trait-query-impl = { path = "../bevy-trait-query-impl" }
17+
tracing.workspace = true
18+
bevy_ecs.workspace = true
19+
bevy_app = { workspace = true, optional = true}
20+
bevy_core = { workspace = true, optional = true}
21+
22+
[dev-dependencies]
23+
criterion.workspace = true
24+
bevy = { workspace = true, default-features = false }
25+
26+
[[bench]]
27+
name = "concrete"
28+
path = "../benches/concrete.rs"
29+
harness = false
30+
31+
[[bench]]
32+
name = "all"
33+
path = "../benches/all.rs"
34+
harness = false
35+
36+
[[bench]]
37+
name = "one"
38+
path = "../benches/one.rs"
39+
harness = false
40+
41+
[[bench]]
42+
name = "fragmented"
43+
path = "../benches/fragmented.rs"
44+
harness = false
File renamed without changes.

src/lib.rs renamed to bevy-trait-query/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,11 @@
245245
//!
246246
//! The performance of trait queries is quite competitive. Here are some benchmarks for simple cases:
247247
//!
248-
//! | | Concrete type | One<dyn Trait> | All<dyn Trait> |
248+
//! | | Concrete type | One<dyn Trait> | All<dyn Trait> |
249249
//! |-------------------|----------------|-------------------|-----------------|
250-
//! | 1 match | 16.135 µs | 31.441 µs | 63.273 µs |
251-
//! | 2 matches | 17.501 µs | - | 102.83 µs |
252-
//! | 1-2 matches | - | 16.959 µs | 82.179 µs |
250+
//! | 1 match | 8.395 µs | 28.174 µs | 81.027 µs |
251+
//! | 2 matches | 8.473 µs | - | 106.47 µs |
252+
//! | 1-2 matches | - | 14.619 µs | 92.876 µs |
253253
//!
254254
255255
use bevy_ecs::{

0 commit comments

Comments
 (0)