From b6bd0067c14ca0bbac2cf430a8030ee9480e6a66 Mon Sep 17 00:00:00 2001 From: Sunil Nimmagadda Date: Wed, 7 Dec 2022 12:12:13 +0530 Subject: Idiomatic imports with use. This is not C and the line limit is 100 by default. Adjusting whitespace-line-column in emacs and let rustfmt handle wrapping long lines. --- src/main.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 66835b6..d390b39 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ -use tokio::signal::unix::{signal, SignalKind}; -use tokio::{time::interval, time::Duration}; +use tokio::signal::unix; +use tokio::time; const ADV_INTERVAL: u64 = 3; const SKEW_INTERVAL: u64 = 1; @@ -19,21 +19,22 @@ async fn sighup_handler() { #[tokio::main(flavor = "current_thread")] async fn main() { let advert_handle = tokio::spawn(async move { - let mut advert_interval = interval(Duration::from_secs(ADV_INTERVAL)); + let mut advert_interval = time::interval(time::Duration::from_secs(ADV_INTERVAL)); loop { advert_interval.tick().await; advert_handler().await; } }); let skew_handle = tokio::spawn(async move { - let mut skew_interval = interval(Duration::from_secs(SKEW_INTERVAL)); + let mut skew_interval = time::interval(time::Duration::from_secs(SKEW_INTERVAL)); loop { skew_interval.tick().await; skew_handler().await; } }); let sighup_handle = tokio::spawn(async move { - let mut stream = signal(SignalKind::hangup()).expect("Should be a signal stream"); + let mut stream = + unix::signal(unix::SignalKind::hangup()).expect("Should be a signal stream"); loop { stream.recv().await; sighup_handler().await; -- cgit v1.2.3