Add processor() method to UNameAPI trait
Adds processor() method that maps machine architecture strings to processor types, matching GNU coreutils behavior.
Fixes uutils/coreutils#8659
Example
let info = PlatformInfo::new()?;
let processor = info.processor(); // "arm" on macOS arm64, "aarch64" on Linux ARM64
This enables uutils/coreutils PR #8842 to migrate from local mapping to platform-info abstraction.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 93.75%. Comparing base (dddde16) to head (f0bb916).
Additional details and impacted files
@@ Coverage Diff @@
## main #96 +/- ##
==========================================
+ Coverage 93.32% 93.75% +0.42%
==========================================
Files 4 5 +1
Lines 734 784 +50
==========================================
+ Hits 685 735 +50
Misses 49 49
| Flag | Coverage Δ | |
|---|---|---|
| macos_latest | 99.35% <100.00%> (+0.19%) |
:arrow_up: |
| ubuntu_latest | 99.37% <100.00%> (+0.18%) |
:arrow_up: |
| windows_latest | 92.99% <100.00%> (+0.40%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
please also update: https://github.com/uutils/platform-info/blob/main/README.md
@sylvestre Updated! README now includes processor() in the example code and output.
give what Colin wrote in https://github.com/uutils/coreutils/pull/8842 not sure we should do it, sorry
Why not? If you want distros to start using it, you need to make it compatible. uutils has its own extensions too, and implements many other GNU extensions.
see: https://github.com/uutils/coreutils/pull/8842#issuecomment-3384684221 (Note that Collin is GNU coreutils upstream)
Anyway, we can still merge this feature in this crate and not use it in the coreutils