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

Persistent State for HashMap::compute #9

Open
ibraheemdev opened this issue Jul 7, 2024 · 0 comments
Open

Persistent State for HashMap::compute #9

ibraheemdev opened this issue Jul 7, 2024 · 0 comments
Labels
feature New feature or request

Comments

@ibraheemdev
Copy link
Owner

Currently HashMap::compute requires an FnMut and has no way of persisting state. For example, inserting a V requires cloning if the operation fails and is retried. Internally we memoize all inserts to avoid this, but that's a hack that shouldn't be expose to users. Instead we might want to provide an on_failure(Operation<V>) hook to allow state to be reset. I don't want the API to become convoluted, so maybe just guaranteeing that inserts are memoized is simpler?

@ibraheemdev ibraheemdev added the feature New feature or request label Jul 7, 2024
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

No branches or pull requests

1 participant