File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
crates/bevy_mod_scripting_core/src Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,30 @@ pub struct HandlerContext<'s, P: IntoScriptPluginParams> {
151
151
}
152
152
153
153
impl < P : IntoScriptPluginParams > HandlerContext < ' _ , P > {
154
+ /// Splits the handler context into its individual components.
155
+ ///
156
+ /// Useful if you are needing multiple resources from the handler context.
157
+ /// Otherwise the borrow checker will prevent you from borrowing the handler context mutably multiple times.
158
+ pub fn destructure (
159
+ & mut self ,
160
+ ) -> (
161
+ & mut CallbackSettings < P > ,
162
+ & mut ContextLoadingSettings < P > ,
163
+ & mut Scripts ,
164
+ & mut RuntimeContainer < P > ,
165
+ & mut ScriptContexts < P > ,
166
+ & mut StaticScripts ,
167
+ ) {
168
+ (
169
+ & mut self . callback_settings ,
170
+ & mut self . context_loading_settings ,
171
+ & mut self . scripts ,
172
+ & mut self . runtime_container ,
173
+ & mut self . script_contexts ,
174
+ & mut self . static_scripts ,
175
+ )
176
+ }
177
+
154
178
/// Get the callback settings
155
179
pub fn callback_settings ( & mut self ) -> & mut CallbackSettings < P > {
156
180
& mut self . callback_settings
You can’t perform that action at this time.
0 commit comments