Skip to content

Commit b1e6617

Browse files
committed
feat: expose macmon as a library crate (#52)
2 parents 1fcca0a + 83b1d67 commit b1e6617

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ readme = "readme.md"
1010
keywords = ["macos", "monitoring", "performance", "cli"]
1111
categories = ["command-line-utilities", "hardware-support"]
1212

13+
[lib]
14+
name = "macmon"
15+
path = "src/lib.rs"
16+
17+
[[bin]]
18+
name = "macmon"
19+
path = "src/main.rs"
20+
1321
[lints.rust]
1422
non_camel_case_types = "allow"
1523
unreachable_code = "allow"

src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//! macmon - Sudoless performance monitoring library for Apple Silicon processors
2+
//!
3+
//! This library provides access to hardware metrics from Apple Silicon processors,
4+
//! including CPU/GPU frequencies, power consumption, temperatures, and memory usage.
5+
6+
pub mod app;
7+
pub mod config;
8+
pub mod debug;
9+
pub mod metrics;
10+
pub mod sources;
11+
12+
// Re-export commonly used types
13+
pub use app::App;
14+
pub use config::{Config, ViewType};
15+
pub use metrics::{Metrics, MemMetrics, Sampler, TempMetrics, zero_div};
16+
pub use sources::SocInfo;

src/main.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
mod app;
2-
mod config;
3-
mod debug;
4-
mod metrics;
5-
mod sources;
6-
7-
use app::App;
1+
use macmon::{App, Sampler, debug};
82
use clap::{CommandFactory, Parser, Subcommand, parser::ValueSource};
9-
use metrics::Sampler;
103
use std::error::Error;
114

125
#[derive(Debug, Subcommand)]

0 commit comments

Comments
 (0)