chrisjuchem / bevy_mod_index

Crate that allows querying components by value in the Bevy game engine.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`cargo +nightly run --example bouncing_balls` -> no method `is_older_than`

stnbu opened this issue · comments

Hi. I was excited to see your crate. I'm trying to rearchitect some things so that I can use an enum to maintain the "state" of an entity, which you can do currently but at the cost of an additional indention level and a small efficiency hit.

...anyway.

I tried to run cargo +nightly run --example bouncing_balls Everything resolved and compiled fine, but when I got to bevy_mod_index I got the following from rustc:

error[E0599]: no method named `is_older_than` found for struct `Tick` in the current scope
  --> src/index.rs:58:18
   |
58 |                 .is_older_than(component.last_changed(), self.current_tick)
   |                  ^^^^^^^^^^^^^ help: there is a method with a similar name: `is_newer_than`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `bevy_mod_index` due to previous error
yolo:bevy_mod_index mburr$ cargo +nightly run --example bouncing_balls
   Compiling bevy_mod_index v0.1.0 (/Users/mburr/git/bevy_mod_index)
error[E0599]: no method named `is_older_than` found for struct `Tick` in the current scope
  --> src/index.rs:58:18
   |
58 |                 .is_older_than(component.last_changed(), self.current_tick)
   |                  ^^^^^^^^^^^^^ help: there is a method with a similar name: `is_newer_than`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `bevy_mod_index` due to previous error

This is with nightly-x86_64-apple-darwin which for me is rustc 1.66.1 (90743e729 2023-01-10).

I did patch ChangeTrackers as indicated. I did this by modifying ~/.cargo/git/checkouts, which I believe works (if a bad practice.)

I think this error occurs before any of that.

BTW... I wonder if instead of patching the source, a so-called "extension trait" could be used.

The bevy main branch was just updated today with this PR that I had submitted to clarify the behavior of that method.

With that and the other pr mentioned in #2, the custom patch is actually no longer necessary. I plan to merge that and update the readme later on today when I have the time.

For now, checkout the tick_fix branch I'm using in that PR, it should work against bevy main.

Also, the extension trait would not have worked because the field I wanted to return was marked pub(crate).

Cool. Thanks for the snappy response(s). That all sounds like nice, rapid progress. I know how it goes! Feel free to close.

For now, checkout the tick_fix branch

tick_fix worked. Nice demo.

#2 was merged, bevy_mod_index/main should now work with bevy/main.