cargo fmt
This commit is contained in:
parent
85f9a44e46
commit
51e702368e
@ -11,9 +11,9 @@ use std::fs;
|
|||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
use std::time::Duration as StdDuration;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use sysinfo::{ProcessRefreshKind, ProcessesToUpdate};
|
use sysinfo::{ProcessRefreshKind, ProcessesToUpdate};
|
||||||
use std::time::Duration as StdDuration;
|
|
||||||
use tracing::warn;
|
use tracing::warn;
|
||||||
|
|
||||||
// Runtime toggles (read once)
|
// Runtime toggles (read once)
|
||||||
|
|||||||
@ -4,9 +4,9 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::atomic::{AtomicBool, AtomicUsize};
|
use std::sync::atomic::{AtomicBool, AtomicUsize};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use std::time::{Duration, Instant};
|
||||||
use sysinfo::{Components, Disks, Networks, System};
|
use sysinfo::{Components, Disks, Networks, System};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use std::time::{Duration, Instant};
|
|
||||||
|
|
||||||
pub type SharedSystem = Arc<Mutex<System>>;
|
pub type SharedSystem = Arc<Mutex<System>>;
|
||||||
pub type SharedComponents = Arc<Mutex<Components>>;
|
pub type SharedComponents = Arc<Mutex<Components>>;
|
||||||
@ -54,7 +54,10 @@ pub struct CacheEntry<T> {
|
|||||||
|
|
||||||
impl<T> CacheEntry<T> {
|
impl<T> CacheEntry<T> {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self { at: None, value: None }
|
Self {
|
||||||
|
at: None,
|
||||||
|
value: None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pub fn is_fresh(&self, ttl: Duration) -> bool {
|
pub fn is_fresh(&self, ttl: Duration) -> bool {
|
||||||
self.at.is_some_and(|t| t.elapsed() < ttl) && self.value.is_some()
|
self.at.is_some_and(|t| t.elapsed() < ttl) && self.value.is_some()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user