Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Remove the config api #3633

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rebase cleanups
  • Loading branch information
DJMcNab committed Feb 14, 2022
commit 9b054199e9800c4d156a172fb6ad4f0d695c115f
12 changes: 4 additions & 8 deletions crates/bevy_ecs/src/system/system_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,7 @@ impl<'w, 's> SystemParam for &'w World {
}

unsafe impl<'w, 's> SystemParamState for WorldState {
type Config = ();

fn init(_world: &mut World, system_meta: &mut SystemMeta, _config: Self::Config) -> Self {
fn init(_world: &mut World, system_meta: &mut SystemMeta) -> Self {
let mut access = Access::default();
access.read_all();
if !system_meta
Expand All @@ -545,8 +543,6 @@ unsafe impl<'w, 's> SystemParamState for WorldState {

WorldState
}

fn default_config() -> Self::Config {}
}

impl<'w, 's> SystemParamFetch<'w, 's> for WorldState {
Expand Down Expand Up @@ -593,16 +589,16 @@ impl<'w, 's> SystemParamFetch<'w, 's> for WorldState {
///
/// ```
/// # use bevy_ecs::prelude::*;
/// # use bevy_ecs::system::assert_is_system;
/// struct Config(u32);
/// struct Myu32Wrapper(u32);
/// fn reset_to(value: Config) -> impl FnMut(ResMut<Myu32Wrapper>) {
/// fn reset_to_system(value: Config) -> impl FnMut(ResMut<Myu32Wrapper>) {
/// move |mut val| val.0 = value.0
/// }
///
/// // .add_system(reset_to(my_config))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this example be more complete? you missed a rename here as it's commented

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're stuck in bevy_ecs here, so I can't create an App, without making a stub implementation. That seemed like quite a lot of effort for the example.

There's not really a great way to demonstrate adding systems within bevy_ecs imo, since every consumer should also be using bevy_app.

The rename does need to happen though, thanks.

/// # reset_to(Config(10)).system();
/// # assert_is_system(reset_to_system(Config(10)));
/// ```

pub struct Local<'a, T: Resource>(&'a mut T);

// SAFE: Local only accesses internal state
Expand Down