1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 05:10:03 -04:00

Introduce lifetime to egui_plot::Plot to replace 'static fields (#4435)

* Closes https://github.com/emilk/egui/issues/4434

Shouldn't break anything, because when all arguments have a 'static
lifetime (required without this PR), the Plot is also 'static and can be
used like before.
This commit is contained in:
Fabian Lippold
2024-05-15 09:58:31 +02:00
committed by GitHub
parent c1eb3f884d
commit ce59e43869
3 changed files with 56 additions and 52 deletions

View File

@@ -81,7 +81,7 @@ pub trait PlotItem {
shapes: &mut Vec<Shape>,
cursors: &mut Vec<Cursor>,
plot: &PlotConfig<'_>,
label_formatter: &LabelFormatter,
label_formatter: &LabelFormatter<'_>,
) {
let points = match self.geometry() {
PlotGeometry::Points(points) => points,
@@ -1735,7 +1735,7 @@ impl PlotItem for BarChart {
shapes: &mut Vec<Shape>,
cursors: &mut Vec<Cursor>,
plot: &PlotConfig<'_>,
_: &LabelFormatter,
_: &LabelFormatter<'_>,
) {
let bar = &self.bars[elem.index];
@@ -1909,7 +1909,7 @@ impl PlotItem for BoxPlot {
shapes: &mut Vec<Shape>,
cursors: &mut Vec<Cursor>,
plot: &PlotConfig<'_>,
_: &LabelFormatter,
_: &LabelFormatter<'_>,
) {
let box_plot = &self.boxes[elem.index];
@@ -2033,7 +2033,7 @@ pub(super) fn rulers_at_value(
plot: &PlotConfig<'_>,
shapes: &mut Vec<Shape>,
cursors: &mut Vec<Cursor>,
label_formatter: &LabelFormatter,
label_formatter: &LabelFormatter<'_>,
) {
if plot.show_x {
cursors.push(Cursor::Vertical { x: value.x });