Skip to content

RUST-2215 Ergonomics for HumanReadable #540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 28, 2025

Conversation

abr-egn
Copy link
Contributor

@abr-egn abr-egn commented May 27, 2025

RUST-2215

This adds several traits to the HumanReadable wrapper type to make it easier to work with:

  • The full set of derive-able traits in the standard library
  • repr(transparent) (technically not a trait but close) so it doesn't cost extra memory
  • a passthrough Display
  • From for convenient/automatic conversions
  • Deref and DerefMut for method passthroughs
  • AsRef and AsMut for reference conversions (so &HumanReadable<String> can be easily converted to &str for example)

@abr-egn abr-egn marked this pull request as ready for review May 27, 2025 19:07
@abr-egn abr-egn requested a review from a team as a code owner May 27, 2025 19:07
@abr-egn abr-egn requested review from isabelatkinson and kevinAlbs and removed request for isabelatkinson May 27, 2025 19:07
isabelatkinson
isabelatkinson previously approved these changes May 28, 2025
Co-authored-by: Isabel Atkinson <[email protected]>
@abr-egn abr-egn merged commit 8755bfb into mongodb:main May 28, 2025
9 of 10 checks passed
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.

2 participants