@@ -18,7 +18,7 @@ use variadics_please::all_tuples;
18
18
#[ cfg( feature = "trace" ) ]
19
19
use tracing:: { info_span, Span } ;
20
20
21
- use super :: { In , IntoSystem , ReadOnlySystem , SystemParamBuilder } ;
21
+ use super :: { IntoSystem , ReadOnlySystem , SystemParamBuilder } ;
22
22
23
23
/// The metadata of a [`System`].
24
24
#[ derive( Clone ) ]
@@ -396,7 +396,7 @@ macro_rules! impl_build_system {
396
396
Input : SystemInput ,
397
397
Out : ' static ,
398
398
Marker ,
399
- F : FnMut ( In < Input > , $( SystemParamItem <$param>) ,* ) -> Out
399
+ F : FnMut ( Input , $( SystemParamItem <$param>) ,* ) -> Out
400
400
+ SystemParamFunction <Marker , Param = ( $( $param, ) * ) , In = Input , Out = Out >,
401
401
>(
402
402
self ,
@@ -474,6 +474,12 @@ impl<Param: SystemParam> SystemState<Param> {
474
474
& self . meta
475
475
}
476
476
477
+ /// Gets the metadata for this instance.
478
+ #[ inline]
479
+ pub fn meta_mut ( & mut self ) -> & mut SystemMeta {
480
+ & mut self . meta
481
+ }
482
+
477
483
/// Retrieve the [`SystemParam`] values. This can only be called when all parameters are read-only.
478
484
#[ inline]
479
485
pub fn get < ' w , ' s > ( & ' s mut self , world : & ' w World ) -> SystemParamItem < ' w , ' s , Param >
@@ -644,6 +650,25 @@ impl<Param: SystemParam> SystemState<Param> {
644
650
self . meta . last_run = change_tick;
645
651
param
646
652
}
653
+
654
+ /// Returns a reference to the current system param states.
655
+ pub fn param_state ( & self ) -> & Param :: State {
656
+ & self . param_state
657
+ }
658
+
659
+ /// Returns a mutable reference to the current system param states.
660
+ /// Marked as unsafe because modifying the system states may result in violation to certain
661
+ /// assumptions made by the [`SystemParam`]. Use with care.
662
+ ///
663
+ /// # Safety
664
+ /// Modifying the system param states may have unintended consequences.
665
+ /// The param state is generally considered to be owned by the [`SystemParam`]. Modifications
666
+ /// should respect any invariants as required by the [`SystemParam`].
667
+ /// For example, modifying the system state of [`ResMut`](crate::system::ResMut) without also
668
+ /// updating [`SystemMeta::component_access_set`] will obviously create issues.
669
+ pub unsafe fn param_state_mut ( & mut self ) -> & mut Param :: State {
670
+ & mut self . param_state
671
+ }
647
672
}
648
673
649
674
impl < Param : SystemParam > FromWorld for SystemState < Param > {
@@ -656,7 +681,7 @@ impl<Param: SystemParam> FromWorld for SystemState<Param> {
656
681
///
657
682
/// You get this by calling [`IntoSystem::into_system`] on a function that only accepts
658
683
/// [`SystemParam`]s. The output of the system becomes the functions return type, while the input
659
- /// becomes the functions [`In`] tagged parameter or `()` if no such parameter exists.
684
+ /// becomes the functions first parameter or `()` if no such parameter exists.
660
685
///
661
686
/// [`FunctionSystem`] must be `.initialized` before they can be run.
662
687
///
0 commit comments