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

Non-static Plot::label_formatter closure #10

Open
zdimension opened this issue Dec 27, 2022 · 0 comments
Open

Non-static Plot::label_formatter closure #10

zdimension opened this issue Dec 27, 2022 · 0 comments

Comments

@zdimension
Copy link

Is your feature request related to a problem? Please describe.

I'm using the Plot component for physical measurements, for which I want to calculate the instantaneous derivative and definite integral, both of which should be displayed in the mouse-hover label.

Problem: the closure expected by Plot::label_formatter needs to be static. I want to compute derivatives and integrals in the label (values that require accessing other plot points than the one being hovered), but this requires borrowing things in the closure, but since it needs to be static, I can't borrow non-static data. I have to resort to weird hacks such as unsafe &* lifetime extension. There may be other ways around, with Arc maybe, but they're not ergonomic.

Describe the solution you'd like

Allow Plot::label_formatter to take a non-static closure.

@emilk emilk transferred this issue from emilk/egui Jul 15, 2024
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

1 participant