Skip to main content

Crate hardware_report

Crate hardware_report 

Source
Expand description

Hardware Report Library

This library provides hardware information collection capabilities using a Ports and Adapters (Hexagonal) architecture for maintainability and testability.

§Architecture

  • Domain: Core business logic and entities
  • Ports: Interfaces for external interactions
  • Adapters: Platform-specific implementations

§Usage

§As a Library

use hardware_report::{HardwareReportingService, ReportConfig};

async fn example() -> Result<(), Box<dyn std::error::Error>> {
    // Create service with platform-specific adapters
    let service = hardware_report::create_service(None).await?;
     
    // Generate hardware report
    let config = ReportConfig::default();
    let report = service.generate_report(config).await?;
     
    println!("System: {} ({})", report.hostname, report.summary.system_info.product_name);
    Ok(())
}

§Legacy Compatibility

The library maintains backward compatibility with the original ServerInfo API:

use hardware_report::ServerInfo;

fn legacy_example() -> Result<(), Box<dyn std::error::Error>> {
    let server_info = ServerInfo::collect()?;
    println!("Hostname: {}", server_info.hostname);
    Ok(())
}

Re-exports§

pub use adapters::FileDataPublisher;
pub use adapters::FileSystemRepository;
pub use adapters::HttpDataPublisher;
pub use adapters::LinuxSystemInfoProvider;
pub use adapters::MacOSSystemInfoProvider;
pub use adapters::UnixCommandExecutor;
pub use container::ContainerConfig;
pub use container::ContainerConfigBuilder;
pub use container::ServiceContainer;
pub use domain::PublishConfig;
pub use domain::PublishError;
pub use domain::ReportConfig;
pub use domain::ReportError;
pub use ports::CommandExecutor;
pub use ports::ConfigurationProvider;
pub use ports::DataPublisher;
pub use ports::FileRepository;
pub use ports::HardwareReportingService;
pub use ports::OutputFormat;
pub use ports::SystemInfoProvider;
pub use domain::HardwareReport as NewHardwareReport;

Modules§

adapters
container
Dependency injection container for hardware reporting services
domain
new_domain
ports
posting

Structs§

BiosInfo
BIOS information
ChassisInfo
Chassis information
CpuInfo
Represents CPU information.
CpuTopology
CPU topology information
GpuDevice
Represents a GPU device.
GpuInfo
Represents GPU information.
HardwareInfo
Contains detailed hardware information
IbInterface
Represents an Infiniband interface.
InfinibandInfo
Represents Infiniband information.
InterfaceIPs
MemoryInfo
Represents memory information.
MemoryModule
Represents a memory module.
MotherboardInfo
Motherboard information
NetworkInfo
Represents network information.
NetworkInterface
Represents a network interface.
NumaDevice
Represents a device attached to a NUMA node
NumaInfo
NumaNode
Represents a NUMA node
ServerInfo
Represents the overall server information
StorageDevice
Represents a storage device.
StorageInfo
Represents storage information.
SystemInfo
SystemSummary
Summary of key system components

Functions§

create_service
Create a hardware reporting service with platform-appropriate adapters
create_service_with_config
Create a hardware reporting service with custom container configuration
validate_system
Validate system dependencies and privileges