sys-lib 0.3.0

System facts for Rust services: OS, CPU, memory, disks, network, host, this process, virtualization, power, and device identity, container-aware by default, plus build info, instance info, and a process guard. No subprocesses, zero third-party dependencies.
Documentation
# =============================================================================
#  R E P S   ยท   sys-lib
# =============================================================================
[package]
name    = "sys-lib"
version = "0.3.0"

# Minimum Supported Rust Version (MSRV)
# 1.89: `std::fs::File::lock` and `File::try_lock` are stable from 1.89.0, so
# the process guard needs no lock FFI (dev/PLAN.md, D-002).
rust-version = "1.89"
edition = "2024"

# License
license = "Apache-2.0 OR MIT"

# Readme
readme = "README.md"

# Description
description = "System facts for Rust services: OS, CPU, memory, disks, network, host, this process, virtualization, power, and device identity, container-aware by default, plus build info, instance info, and a process guard. No subprocesses, zero third-party dependencies."

# Keywords (5 max)
keywords = ["system", "hardware", "cpu", "memory", "os"]

# Categories
categories = ["os", "hardware-support"]

# Links
homepage      = "https://github.com/jamesgober/sys-lib"
repository    = "https://github.com/jamesgober/sys-lib"
documentation = "https://docs.rs/sys-lib"

# Authors
authors = ["James Gober <me@jamesgober.com>"]

# Fixture machines (thousands of small files) and the fuzz crate stay in the
# repository; fixture tests skip when the tree is absent (dev/PLAN.md, D-018).
exclude = ["/tests/fixtures/", "/fuzz/"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
# Every platform's items appear on docs.rs, each with its doc(cfg) badge.
targets = ["x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc", "aarch64-apple-darwin"]

[lib]
name = "sys_lib"
path = "src/lib.rs"

# Threat T16: this test binary also plays the fake programs it plants on PATH,
# so it has its own `main`.
[[test]]
name = "attack_t16_subprocess"
harness = false

# The boot kit example needs instance info and the guard.
[[example]]
name = "boot"
required-features = ["instance", "guard"]

# `cfg(fuzzing)` is set by cargo-fuzz for the parser entry points in `__fuzz`.
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(fuzzing)"] }


# FEATURE FLAGS
# #################################
[features]
default = ["instance", "guard"]

# Instance info: `Instance`, `InstanceId` (brings clock-lib and id-forge).
instance = ["dep:clock-lib", "dep:id-forge"]

# Process guard: `process::guard`, `Guard` (brings path-lib).
guard = ["dep:path-lib"]

# Device identity: the `device` module (from 0.5, bringing crypt-io; until
# then the feature enables nothing, D-043). Off by default: device identifiers
# carry privacy obligations; the caller opts in knowingly.
device-id = []


# DEPENDENCIES
# #################################
[dependencies]
# First-party only, by published version (dev/PLAN.md section 16). No
# third-party runtime dependencies; `default-features = false` has none at all.
clock-lib = { version = "1.1", optional = true, default-features = false, features = ["std"] }
id-forge = { version = "1.0", optional = true, default-features = false, features = ["ulid"] }
path-lib = { version = "1.0", optional = true }


# DEV DEPENDENCIES
# #################################
[dev-dependencies]
# Property tests (REPS: proptest for every invariant).
proptest = { version = "1", default-features = false, features = ["std"] }
# Oracle for the build helper's UTC timestamp formatting.
clock-lib = { version = "1.1", default-features = false, features = ["std"] }

# Test oracles only, never runtime dependencies: the unit tests in
# src/sys/<platform>/ffi.rs compare the size, alignment, and every field offset
# of sys-lib's own #[repr(C)] OS structs with these crates' definitions, on
# every CI target (dev/PLAN.md, D-012).
[target.'cfg(unix)'.dev-dependencies]
libc = "0.2.170"

[target.'cfg(windows)'.dev-dependencies]
windows-sys = { version = "0.61", features = [
    "Win32_Foundation",
    "Win32_NetworkManagement_IpHelper",
    "Win32_NetworkManagement_Ndis",
    "Win32_Networking_WinSock",
    "Win32_Security",
    "Win32_System_Diagnostics_ToolHelp",
    "Win32_System_Ioctl",
    "Win32_System_JobObjects",
    "Win32_System_Power",
    "Win32_System_ProcessStatus",
    "Win32_System_Registry",
    "Win32_System_SystemInformation",
    "Win32_System_Threading",
    "Win32_System_Time",
    "Win32_System_WindowsProgramming",
    "Win32_Storage_FileSystem",
] }


# RELEASE PROFILE
# #################################
[profile.release]
opt-level     = 3
lto           = "fat"
codegen-units = 1
panic         = "abort"
strip         = "symbols"