Skip to content

Commit

Permalink
Update collector code documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteOtter committed Sep 11, 2024
1 parent fd69e1f commit e81dfec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/collectors/dmi_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* TODO:
* 1. Implement Error checking.
* 2. Check netbox api documentation for correct information type.
* 3. REMOVE DEBUG PRINT STATEMENTS.
* */

use crate::collectors::collector_exceptions;
Expand Down Expand Up @@ -355,7 +354,7 @@ fn dmidecode_cpu<T: DmiDecodeTable>(_param: T) -> CpuInformation {
println!("Collecting CPU information...");
let output: String = T::get_dmidecode_table(4);
let output_split: Split<'_, &str> = output.split("\n");
let mut split: Vec<&str> = Vec::new();
let mut split: Vec<&str>;

let mut cpu_information: CpuInformation = CpuInformation {
version: String::new(),
Expand Down
12 changes: 7 additions & 5 deletions src/collectors/network_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//!
use network_interface::Addr::{V4, V6};
use network_interface::{NetworkInterface, NetworkInterfaceConfig};
use serde::{Deserialize, Serialize};
use serde::Serialize;
use std::fs;
use std::io::Read;
use std::net::IpAddr;
Expand Down Expand Up @@ -49,11 +49,11 @@ pub struct NetworkInformation {
///
/// ### Returns
///
/// Vec<NetworkInterface> - A list of all NetworkInterfaces that the crate was able to collect.
/// * `Vec<NetworkInterface>` - A list of all NetworkInterfaces that the crate was able to collect.
///
/// ### Panics
///
/// This function will panic if NetworkInterface::show() returns an Error leading to no interfaces being collected.
/// This function will panic if `NetworkInterface::show()` returns an Error leading to no interfaces being collected.
pub fn collect_network_information(
) -> Result<Vec<NetworkInterface>, collector_exceptions::NoNetworkInterfacesException> {
/*
Expand Down Expand Up @@ -87,6 +87,8 @@ pub fn collect_network_information(

/// Constructs instances of the NetworkInformation struct.
///
/// Loopback device collected by `collect_network_information` is skipped.
///
/// ### Returns
///
/// A list of NetworkInformation objects including information about whether a network is virtual or physical.
Expand Down Expand Up @@ -254,12 +256,12 @@ fn validate_network_speed(interface_name: &str) -> Option<u32> {
Ok(file) => match collect_interface_speed(interface_name, file) {
Ok(speed) => Some(speed),
Err(err) => {
println!("{}", err);
eprintln!("{}", err);
None
}
},
Err(err) => {
println!("{}", err);
eprintln!("{}", err);
None
}
}
Expand Down

0 comments on commit e81dfec

Please sign in to comment.