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 fallible try_get_or_create variants of the get_or_create methods #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Tamschi
Copy link
Contributor

@Tamschi Tamschi commented Jan 8, 2021

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 for LazyTransform::<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.

…ods (and matching tests)

This one is inspired by issue #12, but may not cover all use cases due to the `T: Clone` requirement on `LazyTransform<T, U>`.
Tamschi added a commit to Tamschi/try-lazy-init that referenced this pull request Sep 5, 2021
khuey#17 (Add fallible `try_get_or_create` variants of the `get_or_create` methods) hasn't been progressing since January, but I need this for Asteracea. I'll adopt the crate for now and try to make feature development easy to upstream.
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.

1 participant