#hardware #cpu #bindings #extract #detection #features #libpcuid

bin+lib cpuid

Rust bindings for libpcuid CPU detection and feature extraction library

11 releases

Uses old Rust 2015

0.1.1 Nov 10, 2015
0.1.0 Apr 4, 2015
0.0.9 Mar 27, 2015
0.0.7 Feb 23, 2015
0.0.1 Nov 21, 2014

#59 in #features

Download history 54/week @ 2024-03-13 47/week @ 2024-03-20 55/week @ 2024-03-27 64/week @ 2024-04-03 69/week @ 2024-04-10 233/week @ 2024-04-17 86/week @ 2024-04-24 136/week @ 2024-05-01 101/week @ 2024-05-08 78/week @ 2024-05-15 41/week @ 2024-05-22 117/week @ 2024-05-29 62/week @ 2024-06-05 31/week @ 2024-06-12 33/week @ 2024-06-19 29/week @ 2024-06-26

163 downloads per month
Used in about-system

MIT license

14KB
277 lines

rust-cpuid

crates.io Build Status Coverage Status

Rust bindings for libpcuid CPU detection and feature extraction library.

Usage

First - download, and build libcpuid as described in the readme. Install it by running make install (you may want to run ldconfig afterwards).

Add to your Cargo.toml:

[dependencies]
cpuid = "*"

Add extern crate cpuid to your crate root and you're good to go! For example:

extern crate cpuid;

fn main () {
    match cpuid::identify() {
        Ok(info) => {
            println!("Found: {} CPU, model: {}", info.vendor, info.codename);
            println!("The full brand string is: {}", info.brand);
            println!("Hardware AES support: {}", if info.has_feature(cpuid::CpuFeature::AES) { "yes" } else { "no" });
        },
        Err(err) => println!("cpuid error: {}", err),
    };
    match cpuid::clock_frequency() {
        Some(frequency) => println!("CPU speed: {} MHz", frequency),
        None => println!("Couldn't get CPU speed."),
    };
}

Resources

Author

  • Zbigniew Siciarz (zbigniew at siciarz dot net)

License

This work is released under the MIT license. A copy of the license is provided in the LICENSE file.

Dependencies

~43KB