Adding tokio code
This commit is contained in:
+9
-2
@@ -1,3 +1,10 @@
|
|||||||
fn main() {
|
// TODO: Move this somewhere else
|
||||||
println!("Hello, world!");
|
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