Use async-std to sleep asynchronously (previously done with tokio)

This commit is contained in:
2024-04-05 17:23:48 +02:00
parent fc9411376c
commit b26cb1d982
2 changed files with 6 additions and 2 deletions

View File

@@ -29,6 +29,7 @@ reqwest = "0.11.24"
validator = { version = "0.17.0", features = ["derive"] } validator = { version = "0.17.0", features = ["derive"] }
const_format = "0.2.32" const_format = "0.2.32"
zxcvbn = "2.2.2" zxcvbn = "2.2.2"
async-std = "1.12.0"
[build] [build]
target = "x86_64-unknown-linux-gnu" target = "x86_64-unknown-linux-gnu"

View File

@@ -4,6 +4,9 @@ mod infrastructure;
mod ui; mod ui;
mod utils; mod utils;
use std::time::Duration;
use async_std::task;
use dioxus::prelude::*; use dioxus::prelude::*;
use tokio::time::{sleep, Duration}; use tokio::time::{sleep, Duration};
use tracing::{debug, Level}; use tracing::{debug, Level};
@@ -24,8 +27,8 @@ fn app() -> Element {
// Dummy timer simulating the loading of the application // Dummy timer simulating the loading of the application
let _: Coroutine<()> = use_coroutine(|_: UnboundedReceiver<_>| async move { let _: Coroutine<()> = use_coroutine(|_: UnboundedReceiver<_>| async move {
debug!("Not ready"); debug!("Not ready");
sleep(Duration::from_secs(3)).await; task::sleep(Duration::from_secs(3)).await;
// sleep(Duration::from_secs(0)).await; // task::sleep(Duration::from_secs(0)).await;
debug!("Ready"); debug!("Ready");
ready.set(true); ready.set(true);
}); });