Skip to content

Commit d4ffa3f

Browse files
dburrows0cart
andcommitted
Document what Config is and how to use it. (#2185)
While trying to figure out how to implement a `SystemParam`, I spent a long time looking for a feature that would do exactly what `Config` does. I ignored it at first because all the examples I could find used `()` and I couldn't see a way to modify it. This is documented in other places, but `Config` is a logical place to include some breadcrumbs. I've added some text that gives a brief overview of what `Config` is for, and links to the existing docs on `FunctionSystem::config` for more details. This would have saved me from embarrassing myself by filing #2178. Co-authored-by: Carter Anderson <mcanders1@gmail.com>
1 parent 1f0988b commit d4ffa3f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

crates/bevy_ecs/src/system/system_param.rs

+12
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ pub trait SystemParam: Sized {
4949
/// Additionally, it is the implementor's responsibility to ensure there is no
5050
/// conflicting access across all SystemParams.
5151
pub unsafe trait SystemParamState: Send + Sync + 'static {
52+
/// Values of this type can be used to adjust the behavior of the
53+
/// system parameter. For instance, this can be used to pass
54+
/// values from a `Plugin` to a `System`, or to control the
55+
/// behavior of the `System`.
56+
///
57+
/// The default configuration of the parameter is set by
58+
/// [`SystemParamState::default_config`]. To change it, invoke
59+
/// [`FunctionSystem::config`](super::FunctionSystem::config) when
60+
/// creating the system.
61+
///
62+
/// See [`FunctionSystem::config`](super::FunctionSystem::config)
63+
/// for more information and examples.
5264
type Config: Send + Sync;
5365
fn init(world: &mut World, system_state: &mut SystemState, config: Self::Config) -> Self;
5466
#[inline]

0 commit comments

Comments
 (0)