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

CountDownLatch::wait should return WaitFuture rather than impl Future<Output = ()> #5

Open
tomshackell opened this issue May 8, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@tomshackell
Copy link

tomshackell commented May 8, 2024

Currently CountDownLatch::wait is defined as:

  pub fn wait(&self) -> impl Future<Output = ()> {
        WaitFuture {
            latch: self.clone(),
            state_lock: None,
        }
    }

Unfortunately, I need to put this future in a struct and currently that requires using unstable to use an impl type alias. It would be much easier (with no loss of functionality) if this method were instead defined as:

  pub fn wait(&self) -> WaitFuture {
        WaitFuture {
            latch: self.clone(),
            state_lock: None,
        }
    }

And WaitFuture made pub so that it can be used as a named type.

@wolf4ood
Copy link
Owner

wolf4ood commented May 9, 2024

Hi @tomshackell

thanks for raising this, it should be fine i think, if you some time to spare could you provide a PR for this?

Thanks

@wolf4ood wolf4ood added the enhancement New feature or request label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants