Manually implement Clone for AsyncExecutor
This commit is contained in:
parent
63db56fa68
commit
5d84800c0c
|
@ -82,11 +82,19 @@ pub trait GuiContext: Send + Sync + 'static {
|
||||||
//
|
//
|
||||||
// NOTE: This is separate from `GuiContext` because adding a type parameter there would clutter up a
|
// NOTE: This is separate from `GuiContext` because adding a type parameter there would clutter up a
|
||||||
// lot of structs, and may even be incompatible with the way certain GUI libraries work.
|
// lot of structs, and may even be incompatible with the way certain GUI libraries work.
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct AsyncExecutor<P: Plugin> {
|
pub struct AsyncExecutor<P: Plugin> {
|
||||||
pub(crate) inner: Arc<dyn Fn(P::BackgroundTask) + Send + Sync>,
|
pub(crate) inner: Arc<dyn Fn(P::BackgroundTask) + Send + Sync>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Can't derive this since Rust then requires `P` to also be `Clone`able
|
||||||
|
impl<P: Plugin> Clone for AsyncExecutor<P> {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
Self {
|
||||||
|
inner: self.inner.clone(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A convenience helper for setting parameter values. Any changes made here will be broadcasted to
|
/// A convenience helper for setting parameter values. Any changes made here will be broadcasted to
|
||||||
/// the host and reflected in the plugin's [`Params`][crate::params::Params] object. These
|
/// the host and reflected in the plugin's [`Params`][crate::params::Params] object. These
|
||||||
/// functions should only be called from the main thread.
|
/// functions should only be called from the main thread.
|
||||||
|
|
Loading…
Reference in a new issue