Skip to content

Commit eea8b8f

Browse files
author
not-elm
committed
cargo fmt
1 parent d4f0426 commit eea8b8f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1131
-1022
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
7171
- name: Run clippy
7272
run: cargo clippy --workspace --all-targets --all-features -- -Dwarnings
73-
73+
- name: Check format
74+
run: cargo fmt --all -- --check
7475

7576

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## v0.11.1
2+
[Release note](https://github.com/not-elm/bevy_flurx/releases/tag/v0.11.1)
3+
4+
### Others
5+
6+
- Excluded `assets` directory from publication.
7+
- Use rustfmt to format the code.
8+
19
## v0.11.0
210
[Release note](https://github.com/not-elm/bevy_flurx/releases/tag/v0.11.0)
311

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
[package]
22
name = "bevy_flurx"
3-
version = "0.11.0"
3+
version = "0.11.1"
44
edition = "2021"
55
authors = ["notelm <elmprograminfo@gmail.com>"]
66
categories = ["asynchronous", "game-development"]
77
description = "Allows you to use coroutine in Bevy"
88
keywords = ["game", "gamedev", "bevy", "async"]
99
license = "MIT OR Apache-2.0"
10+
exclude = ["assets/"]
1011
readme = "README.md"
1112
repository = "https://github.com/not-elm/bevy_flurx"
1213

@@ -51,10 +52,10 @@ tokio = { version = "1", optional = true, features = ["sync", "time"] }
5152
async-compat = { version = "0.2", optional = true }
5253

5354
[dev-dependencies]
54-
bevy = { version = "0.16.0" }
55+
bevy = { version = "0.16" }
5556
bevy_test_helper = { git = "https://github.com/not-elm/bevy_test_helper", branch = "v0.16" }
5657
futures = "0.3"
57-
criterion = { version = "0.5", features = ["plotters", "html_reports"] }
58+
criterion = { version = "0.6", features = ["plotters", "html_reports"] }
5859

5960
[features]
6061
default = []

assets/audio/higurashi.ogg

-178 KB
Binary file not shown.

benches/repeat.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,16 @@ fn with_flurx(c: &mut Criterion) {
1515
c.bench_function("repeat action", move |b| {
1616
b.iter(move || {
1717
let mut app = App::new();
18-
app
19-
.add_plugins((
20-
TaskPoolPlugin::default(),
21-
FlurxPlugin
22-
))
18+
app.add_plugins((TaskPoolPlugin::default(), FlurxPlugin))
2319
.init_resource::<Exit>()
24-
.add_systems(Startup, |mut commands: Commands| {
20+
.add_systems(Startup, |mut commands: Commands| {
2521
commands.spawn(Reactor::schedule(|task| async move {
2622
for _ in 0..10000 {
2723
task.will(Update, wait::until(|| true)).await;
2824
task.will(Update, delay::frames().with(1)).await;
2925
}
30-
task.will(Update, once::res::insert().with(Exit(true))).await;
26+
task.will(Update, once::res::insert().with(Exit(true)))
27+
.await;
3128
}));
3229
});
3330

@@ -39,4 +36,4 @@ fn with_flurx(c: &mut Criterion) {
3936
}
4037

4138
criterion_group!(repeat, with_flurx);
42-
criterion_main!(repeat);
39+
criterion_main!(repeat);

benches/single.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ fn single_action(c: &mut Criterion) {
1414
c.bench_function("single action", move |b| {
1515
b.iter(move || {
1616
let mut app = App::new();
17-
app
18-
.add_plugins((
19-
TaskPoolPlugin::default(),
20-
FlurxPlugin
21-
))
17+
app.add_plugins((TaskPoolPlugin::default(), FlurxPlugin))
2218
.init_resource::<Exit>()
2319
.add_systems(Startup, |mut commands: Commands| {
2420
commands.spawn(Reactor::schedule(|task| async move {
@@ -27,10 +23,13 @@ fn single_action(c: &mut Criterion) {
2723
*local += 1;
2824
*local == 10000
2925
})
30-
.then(once::run(|mut exit: ResMut<Exit>| {
26+
.then(once::run(
27+
|mut exit: ResMut<Exit>| {
3128
exit.0 = true;
32-
}))
33-
}).await;
29+
},
30+
))
31+
})
32+
.await;
3433
}));
3534
});
3635

@@ -42,4 +41,4 @@ fn single_action(c: &mut Criterion) {
4241
}
4342

4443
criterion_group!(single, single_action);
45-
criterion_main!(single);
44+
criterion_main!(single);

examples/bug_check/switch_just_change.rs

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,34 @@ struct S;
77

88
fn main() {
99
App::new()
10-
.add_plugins((
11-
DefaultPlugins,
12-
FlurxPlugin
13-
))
10+
.add_plugins((DefaultPlugins, FlurxPlugin))
1411
.add_systems(Startup, setup)
15-
.add_systems(Update, (
16-
console_switch_just_on::<1>.run_if(switch_just_turned_on::<S>),
17-
console_switch_just_on::<2>.run_if(switch_just_turned_on::<S>),
18-
console_switch_just_off::<1>.run_if(switch_just_turned_off::<S>),
19-
console_switch_just_off::<2>.run_if(switch_just_turned_off::<S>)
20-
))
12+
.add_systems(
13+
Update,
14+
(
15+
console_switch_just_on::<1>.run_if(switch_just_turned_on::<S>),
16+
console_switch_just_on::<2>.run_if(switch_just_turned_on::<S>),
17+
console_switch_just_off::<1>.run_if(switch_just_turned_off::<S>),
18+
console_switch_just_off::<2>.run_if(switch_just_turned_off::<S>),
19+
),
20+
)
2121
.run();
2222
}
2323

24-
fn setup(
25-
mut commands: Commands
26-
) {
24+
fn setup(mut commands: Commands) {
2725
commands.spawn(Reactor::schedule(|task| async move {
2826
loop {
29-
task.will(Update, wait::input::just_pressed().with(KeyCode::KeyT)
30-
.then(once::switch::on::<S>())
31-
.then(delay::frames().with(1))
32-
.then(wait::input::just_pressed().with(KeyCode::KeyT))
33-
.then(once::switch::off::<S>())
34-
.then(delay::frames().with(1)),
35-
).await;
27+
task.will(
28+
Update,
29+
wait::input::just_pressed()
30+
.with(KeyCode::KeyT)
31+
.then(once::switch::on::<S>())
32+
.then(delay::frames().with(1))
33+
.then(wait::input::just_pressed().with(KeyCode::KeyT))
34+
.then(once::switch::off::<S>())
35+
.then(delay::frames().with(1)),
36+
)
37+
.await;
3638
}
3739
}));
3840
}

examples/cancel.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ struct Cancel;
1515

1616
fn main() {
1717
App::new()
18-
.add_plugins((
19-
DefaultPlugins,
20-
FlurxPlugin,
21-
))
18+
.add_plugins((DefaultPlugins, FlurxPlugin))
2219
.add_systems(Startup, (setup_camera_and_box, spawn_reactor))
2320
.add_systems(Update, cancel)
2421
.run();

examples/custom_runner.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ use std::time::Duration;
99

1010
fn main() {
1111
App::new()
12-
.add_plugins((
13-
MinimalPlugins,
14-
LogPlugin::default(),
15-
FlurxPlugin,
16-
))
12+
.add_plugins((MinimalPlugins, LogPlugin::default(), FlurxPlugin))
1713
.add_systems(Startup, spawn_reactor)
1814
.run();
1915
}
@@ -27,7 +23,8 @@ fn spawn_reactor(mut commands: Commands) {
2723
message: "After 3 seconds, this message is displayed.",
2824
}))
2925
.then(once::event::app_exit_success())
30-
}).await;
26+
})
27+
.await;
3128
}));
3229
}
3330

@@ -46,8 +43,12 @@ struct DelayedLogRunner {
4643
}
4744

4845
impl Runner for DelayedLogRunner {
49-
fn run(&mut self, world: &mut World, cancellation_handlers: &mut CancellationHandlers) -> RunnerIs {
50-
let cancellation_id = self.cancellation_id.get_or_insert_with(||{
46+
fn run(
47+
&mut self,
48+
world: &mut World,
49+
cancellation_handlers: &mut CancellationHandlers,
50+
) -> RunnerIs {
51+
let cancellation_id = self.cancellation_id.get_or_insert_with(|| {
5152
// You can register a handler that will be invoked when the reactor is canceled.
5253
cancellation_handlers.register(|_world: &mut World| {
5354
info!("CancellationLogRunner is canceled.");
@@ -62,13 +63,13 @@ impl Runner for DelayedLogRunner {
6263
cancellation_handlers.unregister(cancellation_id);
6364
RunnerIs::Completed
6465
}
65-
other => other
66+
other => other,
6667
}
6768
}
6869
}
6970

7071
/// Finally, we create a function that returns an action.
71-
///
72+
///
7273
/// It is recommended that the action's input is passed by the [`ActionSeed::with`] instead of the argument of this function.
7374
/// By doing so, you can pass the input value with [`Pipe::pipe`].
7475
fn delayed_log() -> ActionSeed<DelayedLogInput, &'static str> {
@@ -82,4 +83,4 @@ fn delayed_log() -> ActionSeed<DelayedLogInput, &'static str> {
8283
cancellation_id: None,
8384
}
8485
})
85-
}
86+
}

examples/cut_in.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ fn cut_in_ferris(
135135
mut tick: Local<f32>,
136136
time: Res<Time>,
137137
) {
138-
let Ok((mut t, StartPos(start))) = ferris.single_mut() else{
138+
let Ok((mut t, StartPos(start))) = ferris.single_mut() else {
139139
return;
140140
};
141141
let end = Duration::from_millis(300).as_secs_f32();
@@ -155,5 +155,6 @@ fn move_left_down<const SPEED: u16>(
155155
time: Res<Time>,
156156
) {
157157
let d = time.delta_secs() * SPEED as f32;
158-
ferris.single_mut().unwrap().translation -= bg.single().unwrap().rotation * Vec3::new(d, 0., 0.);
158+
ferris.single_mut().unwrap().translation -=
159+
bg.single().unwrap().rotation * Vec3::new(d, 0., 0.);
159160
}

0 commit comments

Comments
 (0)