Add Clone for component::InstancePre (#5966)
This is present on `wasmtime::InstancePre` and should be available for components as well. Closes #5965
This commit is contained in:
@@ -194,6 +194,7 @@ struct Instantiator<'a> {
|
|||||||
imports: &'a PrimaryMap<RuntimeImportIndex, RuntimeImport>,
|
imports: &'a PrimaryMap<RuntimeImportIndex, RuntimeImport>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
pub enum RuntimeImport {
|
pub enum RuntimeImport {
|
||||||
Func(Arc<HostFunc>),
|
Func(Arc<HostFunc>),
|
||||||
Module(Module),
|
Module(Module),
|
||||||
@@ -464,6 +465,17 @@ pub struct InstancePre<T> {
|
|||||||
_marker: marker::PhantomData<fn() -> T>,
|
_marker: marker::PhantomData<fn() -> T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// `InstancePre`'s clone does not require `T: Clone`
|
||||||
|
impl<T> Clone for InstancePre<T> {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
Self {
|
||||||
|
component: self.component.clone(),
|
||||||
|
imports: self.imports.clone(),
|
||||||
|
_marker: self._marker,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T> InstancePre<T> {
|
impl<T> InstancePre<T> {
|
||||||
/// This function is `unsafe` since there's no guarantee that the
|
/// This function is `unsafe` since there's no guarantee that the
|
||||||
/// `RuntimeImport` items provided are guaranteed to work with the `T` of
|
/// `RuntimeImport` items provided are guaranteed to work with the `T` of
|
||||||
|
|||||||
Reference in New Issue
Block a user