1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

Reduce Plot::show code bloat by adding Plot::show_dyn

This commit is contained in:
Emil Ernerfeldt
2022-04-30 17:51:07 +02:00
parent 003dc4aac9
commit 11e8ffa079

View File

@@ -489,6 +489,14 @@ impl Plot {
/// Interact with and add items to the plot and finally draw it.
pub fn show<R>(self, ui: &mut Ui, build_fn: impl FnOnce(&mut PlotUi) -> R) -> InnerResponse<R> {
self.show_dyn(ui, Box::new(build_fn))
}
fn show_dyn<'a, R>(
self,
ui: &mut Ui,
build_fn: Box<dyn FnOnce(&mut PlotUi) -> R + 'a>,
) -> InnerResponse<R> {
let Self {
id_source,
center_x_axis,