Skip to content

Conversation

@not-elm
Copy link
Owner

@not-elm not-elm commented Oct 25, 2025

Summary

This PR migrates the codebase from the deprecated Event API to the new Message API introduced in Bevy 0.17.

Changes

New Modules

  • src/action/once/message.rs: New module with message-based actions

    • write<M>() - Write a message (replaces send())
    • write_default<M>() - Write default message (replaces send_default())
    • app_exit_success() - Exit app successfully
  • src/action/wait/message.rs: New module for waiting on messages

    • comes<M>() - Wait until message arrives
    • comes_and<M>(predicate) - Wait for message matching predicate
    • read<M>() - Wait and return message
    • read_and<M>(predicate) - Wait and return matching message

Deprecated Modules

  • src/action/once/event.rs: All functions marked as #[deprecated] with migration guidance

    • Functions now delegate to once::message equivalents
  • src/action/wait/event.rs: All functions marked as #[deprecated] with migration guidance

    • Functions now delegate to wait::message equivalents

Updated Files

  • Examples (5 files): All examples now use message API
  • Documentation (11+ files): Updated all docs to use message API
  • README.md: Updated example code
  • Tests & Inline Docs (18 files): All test code and doc comments updated

Migration Path

The old event modules remain functional but deprecated, allowing gradual migration:

// Old (deprecated)
once::event::send().with(AppExit::Success)
wait::event::read::<MyEvent>()

// New
once::message::write().with(AppExit::Success)
wait::message::read::<MyMessage>()

Test Results

  • ✅ All 70 tests passing
  • ✅ Zero deprecation warnings in codebase
  • ✅ All examples build successfully

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

@not-elm not-elm added the enhancement New feature or request label Oct 25, 2025
@not-elm not-elm merged commit a036350 into main Oct 25, 2025
11 checks passed
@not-elm not-elm deleted the event-to-message branch October 25, 2025 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants