Skip to content
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

Add HashMap::try_insert_with #49

Merged
merged 1 commit into from
Jan 15, 2025
Merged

Add HashMap::try_insert_with #49

merged 1 commit into from
Jan 15, 2025

Conversation

ibraheemdev
Copy link
Owner

The API is unfortunately different than try_insert because we can't directly return an OccupiedError in the case that the closure was not called and the value to insert was not created. We could potentially return a variant or generic version of OccupiedError that has an optional not_inserted field, but I'm not sure how useful that would be, so just returning the current value seems more reasonable.

@ibraheemdev ibraheemdev added the feature New feature or request label Jan 15, 2025
@ibraheemdev ibraheemdev merged commit 1229f93 into master Jan 15, 2025
16 checks passed
@ibraheemdev
Copy link
Owner Author

Released in 0.1.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant