Skip to content

feat(core): add HashRateUnit string parsing#174

Merged
cfilipescu merged 2 commits intomasterfrom
pr/ba25de4-only
Mar 14, 2026
Merged

feat(core): add HashRateUnit string parsing#174
cfilipescu merged 2 commits intomasterfrom
pr/ba25de4-only

Conversation

@cfilipescu
Copy link
Collaborator

Summary

  • Adds string parsing support for HashRateUnit in the core type layer.
  • Keeps unit conversion/parsing logic centralized so future API/config inputs can accept human-readable hashrate unit values safely.
  • This is needed groundwork for upcoming integrations where units will be received as strings (for example from config, CLI, or external payloads).

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds FromStr parsing for HashRateUnit in asic-rs-core, enabling conversion from common human-readable unit strings into the core unit enum to support future string-based inputs (config/CLI/external payloads).

Changes:

  • Import std::str::FromStr in the hashrate core type module.
  • Implement FromStr for HashRateUnit with normalization and multiple accepted aliases (e.g., TH, TH/s, TERAHASH).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@cfilipescu cfilipescu merged commit 8d395cf into master Mar 14, 2026
6 checks passed
@cfilipescu cfilipescu deleted the pr/ba25de4-only branch March 14, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants