Skip to content

Commit 8c6a3ba

Browse files
committed
use deprecated warnings to mark type as unsafe
1 parent 49ddcc4 commit 8c6a3ba

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

crates/bevy_mod_scripting_core/src/extractors.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Systems which are used to extract the various resources and components used by BMS.
22
//!
33
//! These are designed to be used to pipe inputs into other systems which require them, while handling any configuration erorrs nicely.
4-
4+
#![allow(deprecated)]
55
use std::ops::{Deref, DerefMut};
66

77
use bevy::ecs::{
@@ -119,11 +119,13 @@ unsafe impl<T: Resource + Default> SystemParam for ResScope<'_, T> {
119119
/// - It is only safe to use when other system parameters do not create aliasing references inside their `get_param` calls
120120
#[derive(SystemParam)]
121121
#[doc(hidden)]
122+
#[deprecated(note = "This type is unsafe to use in systems")]
122123
pub struct EventReaderScope<'s, T: Event> {
123124
events: ResScope<'s, Events<T>>,
124125
reader: Local<'s, EventCursor<T>>,
125126
}
126127

128+
#[allow(deprecated)]
127129
impl<T: Event> EventReaderScope<'_, T> {
128130
/// Read all events that happened since the last read
129131
pub fn read(&mut self) -> EventIterator<'_, T> {

crates/bevy_mod_scripting_core/src/handler.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Contains the logic for handling script callback events
2-
2+
#[allow(deprecated)]
33
use crate::{
44
bindings::{
55
pretty_print::DisplayWithWorld, script_value::ScriptValue, ThreadWorldContainer,
@@ -106,6 +106,7 @@ macro_rules! push_err_and_continue {
106106
/// Passes events with the specified label to the script callback with the same name and runs the callback.
107107
///
108108
/// If any of the resources required for the handler are missing, the system will log this issue and do nothing.
109+
#[allow(deprecated)]
109110
pub fn event_handler<L: IntoCallbackLabel, P: IntoScriptPluginParams>(
110111
world: &mut World,
111112
state: &mut SystemState<(
@@ -124,6 +125,7 @@ pub fn event_handler<L: IntoCallbackLabel, P: IntoScriptPluginParams>(
124125
}
125126

126127
#[profiling::function]
128+
#[allow(deprecated)]
127129
fn event_handler_inner<L: IntoCallbackLabel, P: IntoScriptPluginParams>(
128130
mut entity_query_state: Local<QueryState<(Entity, Ref<ScriptComponent>)>>,
129131
mut script_events: EventReaderScope<ScriptCallbackEvent>,

0 commit comments

Comments
 (0)