Fix Crossplatform mapping for Windows#36
Conversation
WalkthroughThe priority range mappings for converting cross-platform thread priorities to Windows API thread priority enums were adjusted by shifting the lower bounds of several ranges down by one. This change modifies the mapping logic without altering the overall structure or error handling. Changes
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (4)
✨ Finishing Touches
🧪 Generate Unit Tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (2)
- src/windows.rs (1 hunks)
- tests/windows.rs (1 hunks)
Additional comments: 2
tests/windows.rs (1)
- 9-9: The addition of a new test case for a cross-platform value of 80 mapping to
WinAPIThreadPriority::Highestis a good practice to validate the changes made in the mapping logic. It ensures that the new value is correctly handled and mapped, enhancing the test coverage for the priority mapping functionality.src/windows.rs (1)
- 80-83: The adjustments made to the priority ranges in the
TryFrom<ThreadPriority> for WinAPIThreadPriorityimplementation correctly account for the previously missing values (20, 40, 60, and 80) by shifting the ranges forBelowNormal,Normal,AboveNormal, andHighestpriorities. This change ensures a more comprehensive and evenly distributed mapping across Windows thread priority values, aligning with the PR objectives.
|
Hi, could this be merged? |
|
I am really sorry, I don't know how I missed this one! Sure. |
When reading through the Crossplatform value mapping for Windows, I noticed that 20, 40, 60, and 80 were within the valid range of [0,99], but were not covered by the match statement. This PR updates the thread priority ranges to include each of these values as appropriate and also adds a test case for Crossplatform value 80. The ranges were adjusted to keep the Crossplatform values distributed as even as possible across the Windows thread priority values.