lscpu
A Rust implementation of the lscpu command-line utility for displaying CPU architecture information.
Features
- Written in pure Rust
- Fast and lightweight
no_stdcompatible- Easy to integrate as a library
- Cross-platform support (Linux focus)
- Zero external dependencies
Installation
As a Binary
Install the command-line tool directly from crates.io:
After installation, you can run:
As a Library
Add this to your Cargo.toml:
Usage
Command Line
Simply run the installed binary to get CPU information:
)
)
)
)
)
)
)
As a Library
use Cpu;
Development
Building from Source
Running Examples
Run the standard example:
This demonstrates basic usage and can also be run in a no-std environment.
CPU Data Structure
The main Cpu struct provides comprehensive CPU information:
Platform Support
Currently supports:
- Linux (primary target)
- Other Unix-like systems (limited support)
- Windows (not supported yet)
License
This project is licensed under the GPL-3.0 License - see the LICENSE file for details.
Acknowledgments
- Inspired by the original
lscpuutility from util-linux - Built with ❤️ in Rust