summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSunil Nimmagadda <sunil@nimmagadda.net>2022-12-07 12:12:13 +0530
committerSunil Nimmagadda <sunil@nimmagadda.net>2022-12-07 12:12:13 +0530
commitb6bd0067c14ca0bbac2cf430a8030ee9480e6a66 (patch)
tree4c71c919a19a0dae099ce72acb46742e91f4c0b9 /src
parent3d1419ad681c88da758e533afd26f319b32e21cd (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/main.rs11
1 files changed, 6 insertions, 5 deletions
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;