Reduce Plot::show code bloat by adding Plot::show_dyn
This commit is contained in:
parent
003dc4aac9
commit
11e8ffa079
1 changed files with 8 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue