update 'event' in method names to 'event_keys' when the method is actually dealing with event keys

This commit is contained in:
Steve Alexander 2025-07-13 16:28:19 +02:00
parent 727af44215
commit c847595d69
2 changed files with 4 additions and 4 deletions

View File

@ -291,7 +291,7 @@ impl Observer {
/// # Safety
/// The type of the `event_key` [`EventKey`] _must_ match the actual value
/// of the event passed into the observer system.
pub unsafe fn with_event(mut self, event_key: EventKey) -> Self {
pub unsafe fn with_event_key(mut self, event_key: EventKey) -> Self {
self.descriptor.event_keys.push(event_key);
self
}
@ -364,7 +364,7 @@ impl ObserverDescriptor {
/// # Safety
/// The type of each [`EventKey`] in `event_keys` _must_ match the actual value
/// of the event passed into the observer.
pub unsafe fn with_events(mut self, event_keys: Vec<EventKey>) -> Self {
pub unsafe fn with_event_keys(mut self, event_keys: Vec<EventKey>) -> Self {
self.event_keys = event_keys;
self
}

View File

@ -741,7 +741,7 @@ mod tests {
Observer::new(|_: On<Add, A>, mut res: ResMut<Order>| {
res.observed("add/remove");
})
.with_event(on_remove)
.with_event_key(on_remove)
},
);
@ -1015,7 +1015,7 @@ mod tests {
Observer::with_dynamic_runner(|mut world, _trigger, _ptr, _propagate| {
world.resource_mut::<Order>().observed("event_a");
})
.with_event(event_a)
.with_event_key(event_a)
};
world.spawn(observe);