fix example code

This commit is contained in:
glyph 2021-12-13 07:19:05 +02:00
parent 8c3fecb875
commit cfbf052d27
2 changed files with 15 additions and 15 deletions

View File

@ -1,6 +1,6 @@
# peach-stats
![Generic badge](https://img.shields.io/badge/version-0.1.0-<COLOR>.svg)
![Generic badge](https://img.shields.io/badge/version-0.2.0-<COLOR>.svg)
System statistics library for PeachCloud. Provides a wrapper around the [probes](https://crates.io/crates/probes) and [systemstat](https://crates.io/crates/systemstat) crates.
@ -16,15 +16,15 @@ Currently offers the following statistics and associated data structures:
## Example Usage
```rust
use peach_stats::StatsError;
use peach_stats::{stats, StatsError};
fn main() -> Result<(), StatsError> {
let cpu = peach_stats::cpu_stats()?;
let cpu_percentages = peach_stats::cpu_stats_percent()?;
let disks = peach_stats::disk_usage()?;
let load = peach_stats::load_average()?;
let mem = peach_stats::mem_stats()?;
let uptime = peach_stats::uptime()?;
let cpu = stats::cpu_stats()?;
let cpu_percentages = stats::cpu_stats_percent()?;
let disks = stats::disk_usage()?;
let load = stats::load_average()?;
let mem = stats::mem_stats()?;
let uptime = stats::uptime()?;
// do things with the retrieved values...

View File

@ -16,15 +16,15 @@
//! ## Example Usage
//!
//! ```rust
//! use peach_stats::StatsError;
//! use peach_stats::{stats, StatsError};
//!
//! fn main() -> Result<(), StatsError> {
//! let cpu = peach_stats::cpu_stats()?;
//! let cpu_percentages = peach_stats::cpu_stats_percent()?;
//! let disks = peach_stats::disk_usage()?;
//! let load = peach_stats::load_average()?;
//! let mem = peach_stats::mem_stats()?;
//! let uptime = peach_stats::uptime()?;
//! let cpu = stats::cpu_stats()?;
//! let cpu_percentages = stats::cpu_stats_percent()?;
//! let disks = stats::disk_usage()?;
//! let load = stats::load_average()?;
//! let mem = stats::mem_stats()?;
//! let uptime = stats::uptime()?;
//!
//! Ok(())
//! }