Add fallible try_get_or_create
variants of the get_or_create
methods
#17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As it says on the tin, I saw #12 and thought that this would be easy to do while I'm at it.
This pull request may not solve the original issue, due to the
T: Clone
requirement forLazyTransform::<T, U>::try_get_or_create
, so I haven't marked this PR as closing, but avoiding it would involve poisoning the instance, which requires changes to certain panics to be ergonomic (and likely a different error API on the potentially poisoning method).I'm open to implement those changes too if concretely needed, but only after making sure the API I have in mind matches what the maintainers have planned for this crate.