fix(doc): update readme code example

master
Ashley Williams 7 years ago
parent 3675083ac4
commit cf7fed3cbf
  1. 17
      README.md

@ -57,19 +57,18 @@ this project is written in rust. [get rust] to work on this project.
use wasm_bindgen::prelude::*; use wasm_bindgen::prelude::*;
``` ```
4. annotate your public functions with `#[wasm_bindgen]` and `#[no_mangle]`, for example: 4. annotate your public functions with `#[wasm_bindgen]`, for example:
```rust ```rust
#[wasm_bindgen] #[wasm_bindgen]
extern { extern {
fn alert(s: &str); fn alert(s: &str);
} }
#[wasm_bindgen] #[wasm_bindgen]
#[no_mangle] pub fn greet(name: &str) {
pub extern fn greet(name: &str) { alert(&format!("Hello, {}!", name));
alert(&format!("Hello, {}!", name)); }
}
``` ```
5. install this tool: `cargo install wasm-pack` 5. install this tool: `cargo install wasm-pack`

Loading…
Cancel
Save