Split BufferedEvent from Event

This commit is contained in:
Tim Blackbird 2025-07-12 15:28:18 +02:00
parent f1eace62f0
commit 2721e7f1de

View File

@ -259,7 +259,7 @@ pub trait EntityEvent: Event {
const AUTO_PROPAGATE: bool = false; const AUTO_PROPAGATE: bool = false;
} }
/// A buffered [`Event`] for pull-based event handling. /// A buffered event for pull-based event handling.
/// ///
/// Buffered events can be written with [`EventWriter`] and read using the [`EventReader`] system parameter. /// Buffered events can be written with [`EventWriter`] and read using the [`EventReader`] system parameter.
/// These events are stored in the [`Events<E>`] resource, and require periodically polling the world for new events, /// These events are stored in the [`Events<E>`] resource, and require periodically polling the world for new events,
@ -286,7 +286,7 @@ pub trait EntityEvent: Event {
/// ``` /// ```
/// # use bevy_ecs::prelude::*; /// # use bevy_ecs::prelude::*;
/// # /// #
/// #[derive(Event, BufferedEvent)] /// #[derive(BufferedEvent)]
/// struct Message(String); /// struct Message(String);
/// ``` /// ```
/// ///
@ -295,7 +295,7 @@ pub trait EntityEvent: Event {
/// ``` /// ```
/// # use bevy_ecs::prelude::*; /// # use bevy_ecs::prelude::*;
/// # /// #
/// # #[derive(Event, BufferedEvent)] /// # #[derive(BufferedEvent)]
/// # struct Message(String); /// # struct Message(String);
/// # /// #
/// fn write_hello(mut writer: EventWriter<Message>) { /// fn write_hello(mut writer: EventWriter<Message>) {
@ -308,7 +308,7 @@ pub trait EntityEvent: Event {
/// ``` /// ```
/// # use bevy_ecs::prelude::*; /// # use bevy_ecs::prelude::*;
/// # /// #
/// # #[derive(Event, BufferedEvent)] /// # #[derive(BufferedEvent)]
/// # struct Message(String); /// # struct Message(String);
/// # /// #
/// fn read_messages(mut reader: EventReader<Message>) { /// fn read_messages(mut reader: EventReader<Message>) {
@ -327,9 +327,9 @@ pub trait EntityEvent: Event {
#[diagnostic::on_unimplemented( #[diagnostic::on_unimplemented(
message = "`{Self}` is not an `BufferedEvent`", message = "`{Self}` is not an `BufferedEvent`",
label = "invalid `BufferedEvent`", label = "invalid `BufferedEvent`",
note = "consider annotating `{Self}` with `#[derive(Event, BufferedEvent)]`" note = "consider annotating `{Self}` with `#[derive(BufferedEvent)]`"
)] )]
pub trait BufferedEvent: Event {} pub trait BufferedEvent: Send + Sync + 'static {}
/// An internal type that implements [`Component`] for a given [`Event`] type. /// An internal type that implements [`Component`] for a given [`Event`] type.
/// ///