Skip to content

Commit 805bf13

Browse files
examples: migrate async sleep to futures-timer; drop async-std (#19113)
# Objective - Fixes #19055 ## Solution - Replace `async-std` with `futures-timer`. ## Testing CI --------- Co-authored-by: James Liu <[email protected]>
1 parent 2ea9836 commit 805bf13

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ bevy_image = { path = "crates/bevy_image", version = "0.17.0-dev", default-featu
598598
bevy_gizmos = { path = "crates/bevy_gizmos", version = "0.17.0-dev", default-features = false }
599599
# Needed to poll Task examples
600600
futures-lite = "2.0.1"
601-
async-std = "1.13"
601+
futures-timer = { version = "3", features = ["wasm-bindgen", "gloo-timers"] }
602602
crossbeam-channel = "0.5.0"
603603
argh = "0.1.12"
604604
thiserror = "2.0"

examples/async_tasks/async_compute.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use bevy::{
66
prelude::*,
77
tasks::{block_on, futures_lite::future, AsyncComputeTaskPool, Task},
88
};
9+
use futures_timer::Delay;
910
use rand::Rng;
1011
use std::time::Duration;
1112

@@ -62,7 +63,7 @@ fn spawn_tasks(mut commands: Commands) {
6263
let duration = Duration::from_secs_f32(rand::rng().random_range(0.05..5.0));
6364

6465
// Pretend this is a time-intensive function. :)
65-
async_std::task::sleep(duration).await;
66+
Delay::new(duration).await;
6667

6768
// Such hard work, all done!
6869
let transform = Transform::from_xyz(x as f32, y as f32, z as f32);

0 commit comments

Comments
 (0)