Browse Source

impl `Clone` for `wasmtime::component::Linker` (#7032)

The core Wasm `Linker` type is clone, and the component linker needs to be used in similar settings
where clonability is important.
pull/7042/head
Adam C. Foltzer 1 year ago
committed by GitHub
parent
commit
c4f261af15
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      crates/wasmtime/src/component/linker.rs

15
crates/wasmtime/src/component/linker.rs

@ -31,7 +31,20 @@ pub struct Linker<T> {
_marker: marker::PhantomData<fn() -> T>,
}
#[derive(Default)]
impl<T> Clone for Linker<T> {
fn clone(&self) -> Linker<T> {
Linker {
engine: self.engine.clone(),
strings: self.strings.clone(),
map: self.map.clone(),
path: self.path.clone(),
allow_shadowing: self.allow_shadowing,
_marker: self._marker,
}
}
}
#[derive(Clone, Default)]
pub struct Strings {
string2idx: HashMap<Arc<str>, usize>,
strings: Vec<Arc<str>>,

Loading…
Cancel
Save