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 a method to Once to create an already-done Once #441

Open
PlasmaPower opened this issue May 17, 2024 · 1 comment
Open

Add a method to Once to create an already-done Once #441

PlasmaPower opened this issue May 17, 2024 · 1 comment

Comments

@PlasmaPower
Copy link

PlasmaPower commented May 17, 2024

I'm looking at using Once as a sort of dirty flag, and it'd be useful to have a method to create a Once that's already done (i.e. marked as already clean). E.g.:

impl Once {
    #[inline]
    pub const fn new_done() -> Once {
        Once(AtomicU8::new(DONE_BIT))
    }
@Amanieu
Copy link
Owner

Amanieu commented May 24, 2024

The method should be named new_completed for consistency with is_completed. Please send a PR to the standard library as well if you plan on implementing this. I'm happy to accept a PR here.

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