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.
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, withArc
maybe, but they're not ergonomic.Describe the solution you'd like
Allow
Plot::label_formatter
to take a non-static closure.