Skip to content

Commit

Permalink
feat(c-api) Implement wasm_externtype_copy.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Oct 9, 2020
1 parent 5315eef commit 10cc4d2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/c-api/src/wasm_c_api/types/extern_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ pub unsafe extern "C" fn wasm_extern_type(e: &wasm_extern_t) -> Box<wasm_externt
#[no_mangle]
pub unsafe extern "C" fn wasm_externtype_delete(_et: Option<Box<wasm_externtype_t>>) {}

#[no_mangle]
pub unsafe extern "C" fn wasm_externtype_copy(
wasm_externtype: &wasm_externtype_t,
) -> Box<wasm_externtype_t> {
// do shallow copy
Box::new(wasm_externtype_t {
inner: wasm_externtype.inner.clone(),
})
}

impl From<ExternType> for wasm_externtype_t {
fn from(other: ExternType) -> Self {
Self { inner: other }
Expand Down

0 comments on commit 10cc4d2

Please sign in to comment.