gz / rust-cpuid

cpuid library in rust.
https://docs.rs/raw-cpuid/
MIT License
147 stars 43 forks source link

Move pretty-printing into the crate, gated by a feature #137

Closed mkeeter closed 1 year ago

mkeeter commented 1 year ago

We are using rust-cpuid in Humility to decode CPU features, and it has been great!

The pretty-printing code currently in src/bin/cpuid.rs would be very helpful as library code, since we'd like pretty-printing but don't want to call an external binary.

This PR moves that pretty-printing code into a new module (display) in the crate itself. This module is gated by the display feature; by default, it's off and the crate is still no_std. If you enable that feature, then you have access to the raw_cpuid::display module, which exposes those nice pretty-printing functions.

(there's also a bit of feature wrangling to make the cli feature enable display, etc, but nothing too weird)

codecov-commenter commented 1 year ago

Codecov Report

Merging #137 (e71585c) into master (e86d96b) will decrease coverage by 0.02%. The diff coverage is 0.00%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master     #137      +/-   ##
==========================================
- Coverage   39.36%   39.34%   -0.02%     
==========================================
  Files           3        4       +1     
  Lines        4070     4072       +2     
==========================================
  Hits         1602     1602              
- Misses       2468     2470       +2     
Impacted Files Coverage Δ
src/bin/cpuid.rs 4.34% <0.00%> (+4.27%) :arrow_up:
src/display.rs 0.00% <0.00%> (ø)
src/lib.rs 51.26% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

gz commented 1 year ago

hi this lgtm, thanks for the improvement!

gz commented 1 year ago

Released as 10.7.0