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: with_key taking full closures #391

Closed
kC0pter opened this issue Mar 1, 2022 · 2 comments
Closed

Feature request: with_key taking full closures #391

kC0pter opened this issue Mar 1, 2022 · 2 comments

Comments

@kC0pter
Copy link

kC0pter commented Mar 1, 2022

Adding keys with the with_key method currently only takes function pointers or non-capturing closures that are coercible to function pointers.
It would be a nice addition to change that to full closures to be able to capture locals to add to the printing.

@djc
Copy link
Member

djc commented Mar 1, 2022

The problem here is that ProgressStyle is Clone (which seems like a useful property), and it doesn't look like the keys could be Clone while also using dynamic dispatch.

@1Dragoon
Copy link

1Dragoon commented Mar 28, 2022

I think the main thing we're looking for in with_keys closures is that we want to be able to store stateful information that the with_key method can then have read-only access to. So what if we could provide an Option<Box<dyn SomeTrait>> that ProgressState holds on to for us, maybe even ticks it for us, and our with_keys function pointer can then read from it?

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

3 participants