Skip to content

Commit 491328e

Browse files
joseph-gioBrian Merchant
and
Brian Merchant
authored
Add queries that filter based on change detection (#42)
Rebase of #30. Resolves #23. Adds support for trait queries that filter based on change detection. Co-authored-by: Brian Merchant <[email protected]>
1 parent 53ca7c1 commit 491328e

File tree

5 files changed

+952
-168
lines changed

5 files changed

+952
-168
lines changed

proc-macro/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ fn impl_trait_query(arg: TokenStream, item: TokenStream) -> Result<TokenStream2>
114114

115115
let my_crate = proc_macro_crate::crate_name("bevy-trait-query").unwrap();
116116
let my_crate = match my_crate {
117-
proc_macro_crate::FoundCrate::Itself => quote! { crate },
117+
proc_macro_crate::FoundCrate::Itself => quote! { bevy_trait_query },
118118
proc_macro_crate::FoundCrate::Name(x) => {
119119
let ident = quote::format_ident!("{x}");
120120
quote! { #ident }
@@ -156,7 +156,7 @@ fn impl_trait_query(arg: TokenStream, item: TokenStream) -> Result<TokenStream2>
156156
#where_clause
157157
{
158158
type Item<'__w> = #my_crate::ReadTraits<'__w, #trait_object>;
159-
type Fetch<'__w> = #my_crate::ReadAllTraitsFetch<'__w, #trait_object>;
159+
type Fetch<'__w> = <#my_crate::All<&'__a #trait_object> as #imports::WorldQuery>::Fetch<'__w>;
160160
type ReadOnly = Self;
161161
type State = #my_crate::TraitQueryState<#trait_object>;
162162

@@ -264,7 +264,7 @@ fn impl_trait_query(arg: TokenStream, item: TokenStream) -> Result<TokenStream2>
264264
#where_clause
265265
{
266266
type Item<'__w> = #my_crate::WriteTraits<'__w, #trait_object>;
267-
type Fetch<'__w> = #my_crate::WriteAllTraitsFetch<'__w, #trait_object>;
267+
type Fetch<'__w> = <#my_crate::All<&'__a #trait_object> as #imports::WorldQuery>::Fetch<'__w>;
268268
type ReadOnly = &'__a #trait_object;
269269
type State = #my_crate::TraitQueryState<#trait_object>;
270270

0 commit comments

Comments
 (0)