Skip to main content

macstate_core/
lib.rs

1//! macstate-core: macOS system signal collection.
2//!
3//! Exposes network and power signals as serde-serializable structs.
4
5pub mod network;
6pub mod power;
7
8use serde::Serialize;
9
10#[derive(Debug, Clone, Serialize)]
11#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
12#[cfg_attr(
13    feature = "schema",
14    schemars(description = "Snapshot of macOS system signals exposed by `macstate`.")
15)]
16pub struct State {
17    pub network: network::Network,
18    pub power: power::Power,
19}
20
21impl State {
22    pub fn collect() -> Self {
23        Self {
24            network: network::Network::collect(),
25            power: power::Power::collect(),
26        }
27    }
28}