I am learning Rust to WebAssembly from this page : https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_Wasm
I see this code for index.html file
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<title>hello-wasm example</title>
</head>
<body>
<script type="module">
import init, { greet } from "./pkg/hello_wasm.js";
init().then(() => {
greet("WebAssembly");
});
</script>
</body>
</html>
However i do not see an ‘init’ being exported from the hello_wasm.js file in question.
Moreover I changed the above javascript code to
<script type="module">
import myinit, { greet } from "./pkg/hello_wasm.js";
myinit().then(() => {
greet("WebAssembly");
});
</script>
and still the javascript just works fine!.
Please help me understand where is this ‘init’ coming from and how is it supposed to be used.
Thanks
-Mahesh