HdrHistogram / HdrHistogram/HdrHistogram_rust
Express auto resize functionality as a type?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 372
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Description
While working on #10 I'm ending up with error options that can only occur if resize is disabled. This is unfortunate as it means that someone using resize will now have to handle error variants that won't ever occur at runtime.
The way that auto resize interacts with the contracts of the methods is a little regrettable to begin with. I wonder if there's a way we could reflect this difference in the type system rather than with comments here and there describing what will or won't happen when auto resize is enabled. Maybe a trait with associated types for errors and implementations for both auto resize and plain histograms? Almost all the code could be re-used between the two, I think, with just some different error enums to give each style a very precise error mapping.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with issue #10 and trace the existing auto-resize and plain-histogram method contracts and error enums. Compare which errors apply to each mode, then define done as representing those differences in the type system rather than relying on comments, with precise error mappings for both styles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100