Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename App/World::observe to add_observer, EntityWorldMut::observe_entity to observe. #15754

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ItsDoot
Copy link
Contributor

@ItsDoot ItsDoot commented Oct 8, 2024

Objective

Calling the functions App::observe and World::observe doesn't make sense because you're not "observing" the App or World, you're adding an observer that listens for an event that occurs within the World. We should rename them to better fit this.

Solution

Renames:

  • App::observe -> App::add_observer
  • World::observe -> World::add_observer
  • Commands::observe -> Commands::add_observer
  • EntityWorldMut::observe_entity -> EntityWorldMut::observe

(Note this isn't a breaking change as the original rename was introduced earlier this cycle.)

Testing

Reusing current tests.

@ItsDoot ItsDoot added A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Needs-Review Needs reviewer attention (from anyone!) to move forward D-Trivial Nice and easy! A great choice to get started with Bevy D-Domain-Agnostic Can be tackled by anyone with generic programming or Rust skills labels Oct 8, 2024
@ItsDoot ItsDoot added this to the 0.15 milestone Oct 8, 2024
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this rename better :) It would be nice to have a commands.add_observer API too, but that can wait for follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Domain-Agnostic Can be tackled by anyone with generic programming or Rust skills D-Trivial Nice and easy! A great choice to get started with Bevy S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

observe_entity on EntityWorldMut is confusing/inconsistent
2 participants