mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-15 09:40:52 +00:00
[examples] duck-typed-interfaces - port to rust 2018
This commit is contained in:
parent
7107a896da
commit
573c14118a
@ -2,6 +2,7 @@
|
||||
name = "rust-duck-typed-interfaces"
|
||||
version = "0.1.0"
|
||||
authors = ["The wasm-bindgen Developers"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
@ -1,4 +1,3 @@
|
||||
extern crate wasm_bindgen;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
/// Here is a duck-typed interface for any JavaScript object that has a `quack`
|
||||
@ -18,6 +17,6 @@ extern "C" {
|
||||
/// Next, we can export a function that takes any object that quacks:
|
||||
#[wasm_bindgen]
|
||||
pub fn make_em_quack_to_this(duck: &Quacks) {
|
||||
let s = duck.quack();
|
||||
let _s = duck.quack();
|
||||
// ...
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user