Require explicit unsafe blocks inside unsafe functions to make
safety boundaries more precise. This is a forward-looking lint
that prevents future unsafe code from implicitly relying on the
enclosing unsafe fn.
These functions are deprecated as safe in recent Rust versions because
they are not thread-safe. Wrapping them in unsafe blocks with safety
comments documents that the tests run single-threaded.
Replace the duplicated inline doc comment with #![doc = include_str!("../README.md")]
to keep documentation DRY. This resolves the TODO from 2023-05-28.
* Add processor() method to UNameAPI trait
Implements processor type mapping to provide GNU coreutils-compatible
processor information, addressing uutils/coreutils#8659.
Changes:
- Add processor() method to UNameAPI trait with comprehensive docs
- Implement map_processor() helper in lib_impl for arch-to-processor mapping
- Add processor field and implementation to all platform modules (Unix, Windows, unknown)
- Include platform-specific tests verifying correct processor mappings
- Update example code to demonstrate processor() usage
- Add workspace declaration to Cargo.toml to prevent parent workspace inheritance
Processor mapping behavior:
- macOS: arm64 → arm
- Linux: aarch64 → aarch64 (passthrough)
- x86_64/amd64 → x86_64
- i386/i486/i586/i686 → i686
- ARMv6/v7/v8 variants → arm
- Unknown architectures pass through unchanged (better than "unknown")
This provides the foundation for uutils/coreutils to migrate from its
local processor mapping implementation, consolidating platform knowledge
in the appropriate abstraction layer.
Ref: uutils/coreutils#8659
* docs: update README to include processor() method
Add processor() to example code and expected output as requested by @sylvestre
* docs: clarify processor() vs machine() difference and add comprehensive tests
Address review feedback:
- Remove incomplete archive.is placeholder
- Add detailed documentation explaining how processor() differs from machine()
- Include comparison table showing platform-specific behavior
- Add comprehensive unit test for map_processor() covering all branches
- Improves test coverage from 66.66% to 100% in lib_impl.rs