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

[Feature Request] Create OnceLock and OnceCell using this library's Once #440

Open
BLucky-gh opened this issue Apr 26, 2024 · 3 comments
Open

Comments

@BLucky-gh
Copy link

Since unlike Mutex, you can't specify which underlying Once to use with std::sync::OnceLock and std::cell::OnceCell, I would either have to roll my own, which seems wasteful and will not update when the std versions get changed, or manage the value and the Once separately like in the Once example, which is error-prone and puts the burden of upholding invariants on the developer

@Amanieu
Copy link
Owner

Amanieu commented Apr 26, 2024

I would be happy to accept a PR for it, but it is not something I have time to work on myself.

@BLucky-gh
Copy link
Author

I could try making a PR for it, but it will probably be almost entirely just a copy paste of the std implementation and just changing the import from std::sync::Once to parking_lot::Once, would that be any good?

@Amanieu
Copy link
Owner

Amanieu commented Apr 27, 2024

That's fine.

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

No branches or pull requests

2 participants