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

[BUG] 'static lifetime requirement for AreaSeries #62

Closed
JakeOShannessy opened this issue Oct 20, 2019 · 3 comments
Closed

[BUG] 'static lifetime requirement for AreaSeries #62

JakeOShannessy opened this issue Oct 20, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@JakeOShannessy
Copy link

Describe the bug
When using AreaSeries the backend is required to be 'static, e.g. BitmapBackend<'static>. This has a number of limitations, the simplest of which is that a filename passed to the backend must have a static lifetime. This is not the case with other series such as LineSeries. It seems AreaSeries takes a reference to the backend while others do not.

To Reproduce
I modified the area chart example from:

let root = BitMapBackend::new("plotters-doc-data/area-chart.png", (1024, 768)).into_drawing_area();

to:

let filename = "plotters-doc-data/area-chart.png".to_string();
let root = BitMapBackend::new(&filename, (1024, 768)).into_drawing_area();

After doing this the example would no longer compile. This reproduces my problem exactly.

Version Information
Both master and 0.2.9.

@JakeOShannessy JakeOShannessy added the bug Something isn't working label Oct 20, 2019
38 added a commit that referenced this issue Oct 20, 2019
Details: Preivously, we put too many lifetime bound on the dynamic
elements, which pollute the lifetime makes unncessary constraints.
This fix bug #62.
@38
Copy link
Member

38 commented Oct 20, 2019

Hi @JakeOShannessy ,

Thanks for reporting this.
This is caused by strict lifetime bounds on the dynamic elements.
And this is fixed on master, I believe. It would be nice if you can confirm this on your side.

Close it for now and feel free to reopen it if needed.

Cheers,
Hao

@38 38 closed this as completed Oct 20, 2019
@JakeOShannessy
Copy link
Author

All fixed, thanks for the quick response.

@bart-sensirion-qm
Copy link

bart-sensirion-qm commented Jul 23, 2024

Hi, it seems this issue has returned. When using dynamic elements (for example by calling .to_dyn() on the elements you're drawing) the `static requirement returns. I noticed because the path parameter in the ::new call to the backend needed to be a reference with `static lifetime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants