Skip to content

Commit

Permalink
Clarify the config api migration (#347)
Browse files Browse the repository at this point in the history
The 0.7 example of the migration guide for the config api had a few issues. It passed the wrong datatype and it wasn't cleared what the argument of the closer was.

Co-authored-by: Charles <[email protected]>
  • Loading branch information
IceSentry and IceSentry committed Apr 16, 2022
1 parent a8cce14 commit 55027e2
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions content/learn/book/migration-guides/0.6-0.7/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ fn camera_system(cameras: Query<&Camera, With<FirstPassCamera>>) {
// 0.6
struct Config(u32);

fn local_config(local: Local<Config>) {
fn local_is_42(local: Local<Config>) {
assert_eq!(*local.0, 42);
}

Expand All @@ -224,20 +224,15 @@ fn main() {
}

// 0.7
struct Config(u32);

fn local_config(local: u32) -> impl FnMut(ResMut<Config>) {
move |mut val| {
val.0 = local;

assert_eq!(val.0, 42);
fn local_is_42(local: u32) -> impl FnMut() {
// This closure will be the system that will be executed
move || {
assert_eq!(local, 42);
}
}

fn main() {
App::new()
.add_system(local_config(Config(42)))
.run();
App::new().add_system(local_is_42(42)).run();
}
```

Expand Down

0 comments on commit 55027e2

Please sign in to comment.