Skip to content

Commit

Permalink
impl Clone for wasmtime::component::Linker (bytecodealliance#7032)
Browse files Browse the repository at this point in the history
The core Wasm `Linker` type is clone, and the component linker needs to be used in similar settings
where clonability is important.
  • Loading branch information
acfoltzer authored and eduardomourar committed Sep 22, 2023
1 parent 71e52ae commit 5250cfa
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion crates/wasmtime/src/component/linker.rs
Expand Up @@ -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>>,
Expand Down

0 comments on commit 5250cfa

Please sign in to comment.