satisfied cargo clippy
This commit is contained in:
@@ -5,7 +5,7 @@ use crate::models::{HeartbeatDto, IdResponse, MetricDto, RegistrationDto};
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use reqwest::{Client, StatusCode};
|
use reqwest::{Client, StatusCode};
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use tokio::time::{interval, sleep};
|
use tokio::time::sleep;
|
||||||
|
|
||||||
pub async fn register_with_server(
|
pub async fn register_with_server(
|
||||||
base_url: &str,
|
base_url: &str,
|
||||||
|
@@ -21,7 +21,7 @@ pub struct HardwareInfo {
|
|||||||
pub memory: memory::MemoryInfo,
|
pub memory: memory::MemoryInfo,
|
||||||
pub disk: disk::DiskInfo,
|
pub disk: disk::DiskInfo,
|
||||||
pub network: network::NetworkInfo,
|
pub network: network::NetworkInfo,
|
||||||
network_monitor: network::NetworkMonitor,
|
pub network_monitor: network::NetworkMonitor,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HardwareInfo {
|
impl HardwareInfo {
|
||||||
|
@@ -16,6 +16,12 @@ pub struct NetworkMonitor {
|
|||||||
last_update: Instant,
|
last_update: Instant,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for NetworkMonitor {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl NetworkMonitor {
|
impl NetworkMonitor {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@@ -32,7 +32,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
|
|||||||
Ok((id, ip)) => (id, ip),
|
Ok((id, ip)) => (id, ip),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("Fehler bei der Registrierung am Server: {e}");
|
eprintln!("Fehler bei der Registrierung am Server: {e}");
|
||||||
return Err(e.into());
|
return Err(e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -59,12 +59,11 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
|
|||||||
let (heartbeat_handle, metrics_handle) =
|
let (heartbeat_handle, metrics_handle) =
|
||||||
tokio::try_join!(flatten(heartbeat_handle), flatten(metrics_handle))?;
|
tokio::try_join!(flatten(heartbeat_handle), flatten(metrics_handle))?;
|
||||||
|
|
||||||
match (heartbeat_handle, metrics_handle) {
|
let (heartbeat, metrics) = (heartbeat_handle, metrics_handle);
|
||||||
(heartbeat, metrics) => println!(
|
println!(
|
||||||
"All tasks completed successfully: {:?}, {:?}.",
|
"All tasks completed successfully: {:?}, {:?}.",
|
||||||
heartbeat, metrics
|
heartbeat, metrics
|
||||||
),
|
);
|
||||||
}
|
|
||||||
|
|
||||||
println!("All tasks completed successfully.");
|
println!("All tasks completed successfully.");
|
||||||
|
|
||||||
|
@@ -45,7 +45,7 @@ impl Collector {
|
|||||||
Ok(hw) => hw,
|
Ok(hw) => hw,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("Fehler beim Sammeln der Hardware-Infos: {e}");
|
eprintln!("Fehler beim Sammeln der Hardware-Infos: {e}");
|
||||||
return Err(e.into());
|
return Err(e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// Collect network usage
|
// Collect network usage
|
||||||
|
Reference in New Issue
Block a user