You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
We have a somewhat unique setup in which we use dioxus for state management and egui for all of the underlying component rendering. When passing attributes through dioxus we have to cast the incoming type which requires that the trait objects be "object safe". PlotItem is not object safe, so we can't pass it through directly. But we also cannot pass in our own trait which has a method such as fn as_egui_plot_item(&self) -> impl PlotItem because that is also not object safe so instead we have a trait which has a method fn as_egui_plot_item(&self) -> Box<dyn PlotItem>. This cannot be passed to the existing fn add(&self, impl PlotItem) method because Box<dyn PlotItem> does not satisfy the impl PlotItem argument.
Describe the solution you'd like
Add an fn add_boxed(&mut self, Box<dyn PlotItem>) method to allow insertion directly into the underlying plot_itemsVec.
Describe alternatives you've considered
Make PlotItem object safe (likely a pretty large effort and I'm not sure anyone else cares about this).
impl<T: PlotItem> PlotItem for Rc<T> so we can pass an Rc directly to the .add( function. (This could also be done for Arc and others for convenience).
Possibly some more options?
Additional context
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
We have a somewhat unique setup in which we use dioxus for state management and egui for all of the underlying component rendering. When passing attributes through dioxus we have to cast the incoming type which requires that the trait objects be "object safe".
PlotItem
is not object safe, so we can't pass it through directly. But we also cannot pass in our own trait which has a method such asfn as_egui_plot_item(&self) -> impl PlotItem
because that is also not object safe so instead we have a trait which has a methodfn as_egui_plot_item(&self) -> Box<dyn PlotItem>
. This cannot be passed to the existingfn add(&self, impl PlotItem)
method becauseBox<dyn PlotItem>
does not satisfy theimpl PlotItem
argument.Describe the solution you'd like
Add an
fn add_boxed(&mut self, Box<dyn PlotItem>)
method to allow insertion directly into the underlyingplot_items
Vec
.Describe alternatives you've considered
PlotItem
object safe (likely a pretty large effort and I'm not sure anyone else cares about this).impl<T: PlotItem> PlotItem for Rc<T>
so we can pass anRc
directly to the.add(
function. (This could also be done forArc
and others for convenience).Additional context
The text was updated successfully, but these errors were encountered: