Async init #6
+9
-2
@@ -1,3 +1,10 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
// TODO: Move this somewhere else
|
||||
pub const SECONDS_TO_SLEEP: u64 = 5;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
loop {
|
||||
println!("Do some work");
|
||||
tokio::time::sleep(tokio::time::Duration::from_secs(SECONDS_TO_SLEEP)).await;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user