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

Support std::lazy::OnceCell (unstable: RFC 2788) #2104

Closed
wants to merge 1 commit into from

Conversation

Techcable
Copy link

Let me know if anything needs fixing or if this should have a dedicated feature flag.

Fixes #1952

See also serde-rs#812 for other unstable functionality in serde.

Fixes serde-rs#1952
Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be able to share a detailed example of a use case where this impl would be beneficial?

Unlike RefCell, storing OnceCell in a data structure seems pretty unusual. I've only ever seen them in static.

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave #1952 open for now in case someone wants to chip in with use cases, but I am closing this PR as I am not convinced of the value for real-world code.

Thanks anyway for the PR!

@dtolnay dtolnay closed this Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

impl Serialize for OnceCell
2 participants