{"id":9376,"date":"2021-08-16T07:00:49","date_gmt":"2021-08-15T22:00:49","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=9376"},"modified":"2021-07-31T03:13:24","modified_gmt":"2021-07-30T18:13:24","slug":"webassembly-%e3%82%92-rust-%e3%81%a7%e3%81%a4%e3%81%8f%e3%82%8a%e3%80%81javascript-%e3%81%a7%e3%81%a4%e3%81%8b%e3%81%86","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=9376","title":{"rendered":"WebAssembly \u3092 Rust \u3067\u3064\u304f\u308a\u3001JavaScript \u3067\u3064\u304b\u3046"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u79c1\u306e\u958b\u767a\u30e1\u30a4\u30f3\u306f<code>PHP<\/code>\uff08Laravel\uff09+ <code>JavaScript<\/code>\uff08Vue.js\uff09\u3067\u3001\u3082\u3057\u3053\u308c\u3089\u306b\u4e0d\u5411\u304d\u306a\u90e8\u5206\u304c\u3042\u308c\u3070<code>Python<\/code>\u3092\u4f7f\u3046\u3068\u3044\u3046\u5f62\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u3053\u306e\uff13\u3064\u304c\u3042\u308c\u3070\uff08\u79c1\u306e\uff09\u696d\u52d9\u7684\u306b\u56f0\u308b\u3053\u3068\u306f\u307b\u307c\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u6839\u3063\u304b\u3089\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u597d\u304d\u3067\u3059\u306e\u3067\u3001\u300c<strong>\u5225\u306e\u30c6\u30af\u30ce\u30ed\u30b8\u30fc\u3082\u304b\u3058\u3063\u3066\u304a\u304d\u305f\u3044<\/strong>\u300d\u6b32\u304c\u3042\u3063\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u6ce8\u76ee\u3057\u305f\u306e\u304c\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">Rust\u8a00\u8a9e<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u306a\u305c\u300c<strong>Rust\u8a00\u8a9e<\/strong>\u300d\u304b\u3068\u3044\u3046\u3068\u3001\u30d6\u30e9\u30a6\u30b6\u306e<code>JavaScript<\/code>\u3092\u9ad8\u901f\u5316\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u300c<strong>WebAssembly<\/strong>\u300d\u3092\u3064\u304f\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u304b\u3089\u306a\u3093\u3067\u3059\u306d\u3002<\/p>\n<p>\u203b <code>WebAssembly<\/code>\u306b\u3064\u3044\u3066\u306f\u3001\u904e\u53bb\u8a18\u4e8b\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u305c\u3072\u3054\u89a7\u304f\u3060\u3055\u3044\u3002\uff08\u524d\u56de\u306fC\u8a00\u8a9e\u3092\u4f7f\u3044\u307e\u3057\u305f\uff09<\/p>\n<p><strong>\ud83d\udcdd \u53c2\u8003\u30da\u30fc\u30b8\uff1a<\/strong>\u00a0<a href=\"https:\/\/blog.capilano-fw.com\/?p=5446\">\u5165\u9580\uff01WebAssembly\u3092\u8a66\u3057\u3066\u307f\u305f<\/a><\/p>\n<p>\u3064\u307e\u308a\u3001<code>Rust<\/code>\u8a00\u8a9e\u306f<strong>\u30a6\u30a7\u30d6\u958b\u767a\u306b\u95a2\u9023\u3055\u305b\u308b\u3053\u3068\u3082\u3067\u304d\u308b<\/strong>\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p>\u4eca\u56de\u306f<code>Rust<\/code>\u8a00\u8a9e\u3067<code>WebAssembly<\/code>\u3092\u3064\u304f\u3063\u3066\uff08\u30d6\u30e9\u30a6\u30b6\u306e\uff09<code>JavaScript<\/code>\u3067\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u4f55\u304b\u306e\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f\u3089\u5b09\u3057\u3044\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4445 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png\" alt=\"\" width=\"370\" height=\"310\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2-300x251.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/>\u300cWebAssembly\u306f<br \/>\n\u30b2\u30fc\u30e0\u958b\u767a\u3067\u3082<br \/>\n\u4f7f\u308f\u308c\u308b\u3089\u3057\u3044\u3067\u3059\u3088\u300d<\/p>\n<h1>Rust \u8a00\u8a9e\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h1>\n<p>\u307e\u305a\u306f<code>Rust<\/code>\u8a00\u8a9e\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u3059\u304c\u3001\u3053\u3061\u3089\u306f<a href=\"https:\/\/www.rust-lang.org\/tools\/install\" target=\"_blank\" rel=\"noopener\">\u672c\u5bb6\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30da\u30fc\u30b8<\/a><\/p>\n<p>\u3092\u53c2\u8003\u306b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002\uff08\u3059\u307f\u307e\u305b\u3093\u3001<code>Linux<\/code>\u74b0\u5883\u306a\u306e\u3067\u30fb\u30fb\u30fb\ud83d\udca6\uff09<\/p>\n<p>\u306a\u304a\u3001<code>Ubuntu<\/code>\u306e\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308c\u3070\u81ea\u52d5\u7684\u306b\u5b8c\u4e86\u3057\u307e\u3059\u3002\uff08\u9014\u4e2d\u30aa\u30d7\u30b7\u30e7\u30f3\u9078\u629e\u304c\u3042\u308a\u307e\u3059\u304c\u3001<code>default<\/code>\u306e\u3082\u306e\u3067OK\u3067\u3059\uff09<\/p>\n<pre><strong>curl --proto '=https' --tlsv1.2 -sSf https:\/\/sh.rustup.rs | sh<\/strong><\/pre>\n<h1>Rust\u958b\u767a\u74b0\u5883\u306e\u6e96\u5099\u3092\u3059\u308b<\/h1>\n<h2>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u3064\u304f\u308b<\/h2>\n<p>\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\uff08\u9ed2\u3044\u753b\u9762\u306e\u3084\u3064\u3067\u3059\uff09\u3067<code>Rust<\/code>\u958b\u767a\u3092\u3059\u308b\u305f\u3081\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u79fb\u52d5\u3057\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>cargo new --lib hello-wasm<\/strong><\/pre>\n<p>\u203b \u306a\u304a\u3001<code>Cargo<\/code>\u3068\u306f<code>npm<\/code>\u3084<code>composer<\/code>\u306e\u3088\u3046\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u30fb\u30de\u30cd\u30fc\u30b8\u30e3\u3067\u3059\u3002\u79c1\u306e\u74b0\u5883\u3067\u306f\u3001<code>rust<\/code>\u8a00\u8a9e\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3068\u81ea\u52d5\u7684\u306b<code>cargo<\/code>\u30b3\u30de\u30f3\u30c9\u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3057\u305f \ud83d\udc4d<\/p>\n<p>\u5b9f\u884c\u3059\u308b\u3068\u3001<code>hello-wasm<\/code>\u30d5\u30a9\u30eb\u30c0\u304c\u4f5c\u6210\u3055\u308c\u3001\u4e2d\u306b\u3044\u308d\u3044\u308d\u3068\u5fc5\u8981\u306a\u30d5\u30a1\u30a4\u30eb\u304c\u5165\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u5b9f\u969b\u306b\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3059\u308b\u306e\u306f<code>src\/lib.rs<\/code>\u3067\u3059\u3002<\/p>\n<p>\u203b \u306a\u304a\u3001\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u521d\u671f\u72b6\u614b\u3067\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u304c\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u4e0d\u8981\u3067\u3059\u306e\u3067<strong>\u5168\u3066\u6d88\u3057\u3066\u3057\u307e\u3063\u3066\u554f\u984c\u306a\u3044\u3067\u3059\u3002<\/strong><\/p>\n<h2>Cargo\u306b\u30d3\u30eb\u30c9\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h2>\n<p><code>WebAssembly<\/code>\u3092\u3064\u304f\u308b\u305f\u3081\u306e<code>Cargo<\/code>\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>cargo install wasm-pack<\/strong><\/pre>\n<p>\u5c11\u3057\u6642\u9593\u306f\u304b\u304b\u308a\u307e\u3059\u304c\u3001\u7279\u306b\u9014\u4e2d\u3067\u4f55\u3082\u3059\u308b\u3053\u3068\u306f\u306a\u3044\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<h2>\u30b3\u30f3\u30d5\u30a3\u30b0\u8a2d\u5b9a\u3092\u3059\u308b<\/h2>\n<p><code>Cargo<\/code>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306f<code>Cargo.toml<\/code>\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u306e\u4e2d\u306b\u66f8\u304d\u8fbc\u307f\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\uff08<strong>\u592a\u6587\u5b57<\/strong>\u306e\u90e8\u5206\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\uff09<\/p>\n<p><strong>Cargo.toml<\/strong><\/p>\n<pre>[package]\r\nname = \"hello-wasm\"\r\nversion = \"0.1.0\"\r\nedition = \"2018\"\r\n\r\n# See more keys and their definitions at https:\/\/doc.rust-lang.org\/cargo\/reference\/manifest.html\r\n\r\n<strong>[lib]<\/strong>\r\n<strong>crate-type = [\"cdylib\"]<\/strong>\r\n\r\n[dependencies]\r\n<strong>wasm-bindgen = \"0.2\"<\/strong><\/pre>\n<h1>WebAssembly \u7528\u306e\u30b3\u30fc\u30c9\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b<code>Rust<\/code>\u3067<code>WebAssembly<\/code>\u7528\u306e\u30b3\u30fc\u30c9\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><strong>src\/lib.rs<\/strong><\/p>\n<pre><strong>use wasm_bindgen::prelude::*;<\/strong>\r\n\r\n<strong>#[wasm_bindgen]<\/strong>\r\n<strong>extern {<\/strong>\r\n<strong>    pub fn alert(s: &amp;str);<\/strong>\r\n<strong>}<\/strong>\r\n\r\n<strong>#[wasm_bindgen]<\/strong>\r\n<strong>pub fn greet(name: &amp;str) {<\/strong>\r\n<strong>    alert(&amp;format!(\"{} \u3055\u3093\u3001\u3053\u3093\u306b\u3061\u306f\uff01\", name));<\/strong>\r\n<strong>}<\/strong><\/pre>\n<p>\u4e2d\u8eab\u3068\u3057\u3066\u306f\u30b7\u30f3\u30d7\u30eb\u306b\u540d\u524d\u3092\u30b2\u30c3\u30c8\u3057\u305f\u3089<code>alert()<\/code>\u3067\u8868\u793a\u3059\u308b\u3060\u3051\u306e\u3082\u306e\u3067\u3059\u3002<\/p>\n<h1>Rust \u3092\u30d3\u30eb\u30c9\u3057\u3066WebAssembly \u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5148\u307b\u3069\u306e\u30b3\u30fc\u30c9\u3092<code>WebAssembly<\/code>\u5316\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>wasm-pack build --target web<\/strong><\/pre>\n<p>\u3053\u308c\u3067\u3001<code>pkg<\/code>\u30d5\u30a9\u30eb\u30c0\u306e\u4e2d\u306b<code>WebAssembly<\/code>\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u308b\u306f\u305a\u3067\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9381\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/07\/rust_webassembly_1.png\" alt=\"\" width=\"425\" height=\"166\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/07\/rust_webassembly_1.png 425w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/07\/rust_webassembly_1-300x117.png 300w\" sizes=\"auto, (max-width: 425px) 100vw, 425px\" \/><\/p>\n<h1>JavaScript\u3067\u4f7f\u3063\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u4f5c\u6210\u3055\u308c\u305f<code>WebAssembly<\/code>\u3092<code>JavaScript<\/code>\u3067\u4f7f\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u2757<\/p>\n<h2>WebAssembly\u3092\u8a2d\u7f6e\u3059\u308b<\/h2>\n<p>\u4eca\u56de\u306f\u3001<code>Laravel<\/code>\u5185\u3067\u4f7f\u3046\u624b\u9806\u3067\u3059\u304c\u3001\u5225\u306e\u74b0\u5883\u3067\u3082\u540c\u69d8\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u306f\u5148\u307b\u3069\u306e<code>pkg<\/code>\u30d5\u30a9\u30eb\u30c0\u3092<strong>\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u5834\u6240\u306b\u8a2d\u7f6e\u3057\u307e\u3059\u3002<\/strong><\/p>\n<p>\u3064\u307e\u308a\u3001<code>Laravel<\/code>\u3060\u3068<code>public<\/code>\u30d5\u30a9\u30eb\u30c0\u3067\u3059\u306d\u3002<br \/>\n\u4eca\u56de\u306f\u300c<strong>\/public\/wasm\/hello-wasm\/pkg<\/strong>\u300d\u3068\u3057\u3066\u8a2d\u7f6e\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9382\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/07\/rust_webassembly_2.png\" alt=\"\" width=\"430\" height=\"157\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/07\/rust_webassembly_2.png 430w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/07\/rust_webassembly_2-300x110.png 300w\" sizes=\"auto, (max-width: 430px) 100vw, 430px\" \/><\/p>\n<h2>WebAssembly \u3092\u4f7f\u3046\u30b3\u30fc\u30c9\u3092\u3064\u304f\u308b<\/h2>\n<p>\u3067\u306f\u3001<code>Laravel<\/code>\u306b\u4ee5\u4e0b\u306e\u30d3\u30e5\u30fc\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<p><strong>resources\/views\/wasm.blade.php<\/strong><\/p>\n<pre>&lt;html&gt;\r\n&lt;body&gt;\r\n<strong>&lt;!-- WebAssembly\u7528\u306e\u30b3\u30fc\u30c9 --&gt;<\/strong>\r\n<strong>&lt;script type=\"module\"&gt;<\/strong>\r\n\r\n<strong>    import init, {greet} from \".\/wasm\/hello-wasm\/pkg\/hello_wasm.js\";<\/strong>\r\n\r\n<strong>    init()<\/strong>\r\n<strong>        .then(() =&gt; {<\/strong>\r\n\r\n<strong>            window.greet = greet;<\/strong>\r\n\r\n<strong>        });<\/strong>\r\n\r\n<strong>&lt;\/script&gt;\r\n\r\n&lt;!-- \u901a\u5e38\u306e JavaScript --&gt;<\/strong>\r\n<strong>&lt;script&gt;<\/strong>\r\n\r\n<strong>    window.onload = () =&gt; {<\/strong>\r\n\r\n<strong>        console.log(typeof greet); \/\/ \u3053\u3053\u3067\u306f\u307e\u3060\u8aad\u307f\u8fbc\u307e\u308c\u3066\u3044\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308b<\/strong>\r\n\r\n<strong>        let timer = setInterval(() =&gt; {<\/strong>\r\n\r\n<strong>            if(typeof greet === 'function') {<\/strong>\r\n\r\n<strong>                greet(\"\u5c71\u7530\u592a\u90ce\");<\/strong>\r\n<strong>                clearInterval(timer);<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>        }, 100)<\/strong>\r\n\r\n<strong>    };<\/strong>\r\n\r\n<strong>&lt;\/script&gt;<\/strong>\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u3053\u3053\u3067\u3001\u5c11\u3057\u901a\u5e38\u306e<code>JavaScript<\/code>\u3068\u306f\u9055\u3046\u90e8\u5206\u304c\u3067\u3066\u304d\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre>&lt;script <strong>type=\"module\"<\/strong>&gt;\r\n\r\n    \/\/ \u7701\u7565\r\n\r\n&lt;\/script&gt;<\/pre>\n<p>\u306e\u90e8\u5206\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u308c\u306f\u79c1\u3082\u5b9f\u969b\u306b\u4f7f\u3063\u305f\u306e\u306f\u521d\u3081\u3066\u3067\u3059\u304c\u3001\u30b3\u30fc\u30c9\u306e\u901a\u308a\u300c<strong>\u30e2\u30b8\u30e5\u30fc\u30eb<\/strong>\u300d\u3092\u4f7f\u3046\u30b3\u30fc\u30c9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001\u4eca\u56de\u306e\u4f8b\u3067\u8a00\u3046\u3068\u3001<code>init()<\/code>\u3067<strong>WebAssembly\u306e\u6e96\u5099\u3092\u3057\u3001\u305d\u308c\u304c\u5b8c\u4e86\u3057\u3066\u521d\u3081\u3066 Rust \u8a00\u8a9e\u3067\u66f8\u3044\u305f\u30b3\u30fc\u30c9\u304c\u5b9f\u884c\u3067\u304d\u308b<\/strong>\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u30da\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u3066\u3059\u3050\u5b9f\u884c\u3057\u3066\u3082\u95a2\u6570\u304c\u6e96\u5099\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u304c\u3042\u308b\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u90e8\u5206\u3067<code>greet()<\/code>\u304c\u95a2\u6570\u3068\u3057\u3066\u4f7f\u3048\u308b\u304b\u3069\u3046\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3044\u308b\u308f\u3051\u3067\u3059\u3002<\/p>\n<pre>if(<strong>typeof greet === 'function'<\/strong>) { \/\/ \ud83d\udc48 \u30db\u30f3\u30c8\u306b\u95a2\u6570\u306a\u306e\uff1f\uff1f\u3092\u30c1\u30a7\u30c3\u30af\r\n\r\n    \/\/ \u7701\u7565\r\n\r\n}<\/pre>\n<p>\u305d\u3057\u3066\u3001\u3053\u306e\u30d3\u30e5\u30fc\u3092<code>Laravel<\/code>\u306e\u30eb\u30fc\u30c8\u306b\u767b\u9332\u3059\u308c\u3070\u5b8c\u6210\u3067\u3059\u3002<\/p>\n<p><strong>routes\/web.php<\/strong><\/p>\n<pre><strong>Route::get('wasm_test', fn() =&gt; view('wasm'));<\/strong><\/pre>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u3059\u3050\u7d42\u308f\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u304c\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u300c<strong>http:\/\/******\/wasm_test<\/strong>\u300d\u306b\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9383\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/07\/rust_webassembly_3.png\" alt=\"\" width=\"441\" height=\"141\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/07\/rust_webassembly_3.png 441w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/07\/rust_webassembly_3-300x96.png 300w\" sizes=\"auto, (max-width: 441px) 100vw, 441px\" \/><\/p>\n<p>\u306f\u3044\u2757<\/p>\n<p><code>Rust<\/code>\u8a00\u8a9e\u3067\u66f8\u3044\u305f<code>alert()<\/code>\u304c\u5b9f\u884c\u3055\u308c\u307e\u3057\u305f\u3002<br \/>\n\u6210\u529f\u3067\u3059\ud83d\ude0a\u2728<\/p>\n<h1>\u4f01\u696d\u69d8\u3078\u306e\u3054\u63d0\u6848<\/h1>\n<p><code>WebAssembly<\/code>\u3092\u4f7f\u3046\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30d0\u30a4\u30ca\u30ea\u30b3\u30fc\u30c9\u306e\u5b9f\u884c\u306a\u306e\u3067\u9ad8\u901f\u306b\u51e6\u7406\u304c\u3067\u304d\u308b\u3002\uff08\u3064\u307e\u308a\u3001\u73fe\u5728\u30d6\u30e9\u30a6\u30b6\u3067\u306e\u51e6\u7406\u306b\u6642\u9593\u304c\u304b\u304b\u3063\u3066\u3044\u308b\u90e8\u5206\u3092\u9ad8\u901f\u5316\u3067\u304d\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\uff09<\/li>\n<li>WebAssembly \u306f\u4e00\u5ea6\u4f5c\u3063\u3066\u304a\u304f\u3068\u4ed6\u306e\u30b7\u30b9\u30c6\u30e0\u306b\u3082\u7d44\u307f\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3001\u300c\u4f7f\u3044\u56de\u3057\u300d\u304c\u3067\u304d\u308b<\/li>\n<li>\u307e\u3060\u767a\u5c55\u9014\u4e0a\u306e\u3088\u3046\u3067\u3059\u304c Wasmer \u3068\u3044\u3046\u6280\u8853\u3092\u4f7f\u3046\u3068PHP\u306a\u3069\u69d8\u3005\u306a\u8a00\u8a9e\u304b\u3089\u3082 WebAssembly \u3092\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\uff08\u203b\uff11\uff09<\/li>\n<\/ul>\n<p><strong>\u203b\uff11\uff1a \u53c2\u8003\u30da\u30fc\u30b8\uff1a<\/strong>\u00a0<a href=\"https:\/\/wasmer.io\/\" target=\"_blank\" rel=\"noopener\">Wasmer<\/a><\/p>\n<p>\u3082\u3057\u4e0a\u8a18\u306e\u3088\u3046\u306a\u6a5f\u80fd\u3092\u3054\u5e0c\u671b\u3067\u3057\u305f\u3089\u3001\u305c\u3072\u304a\u6c17\u8efd\u306b\u304a\u554f\u3044\u5408\u308f\u305b\u304b\u3089\u3054\u9023\u7d61\u304f\u3060\u3055\u3044\u3002\u3069\u3046\u305e\u3088\u308d\u3057\u304f\u304a\u9858\u3044\u3044\u305f\u3057\u307e\u3059\u3002m(_ _)m<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f\u306f\u3058\u3081\u3066\u300c<strong>Rust\u8a00\u8a9e<\/strong>\u300d\u3092\u4f7f\u3044\u3001<code>WebAssembly<\/code>\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u306a\u304a\u3001\u5b9f\u306f\u5f53\u521d\u3082\u3046\u4e00\u3064\u6ce8\u76ee\u3057\u3066\u3044\u305f\u300c<strong>Go\u8a00\u8a9e<\/strong>\u300d\u3067<code>WebAssembly<\/code>\u3092\u4f5c\u308b\u3064\u3082\u308a\u3067\u3057\u305f\u3002<\/p>\n<p>\u7d50\u679c\u3068\u3057\u3066<code>WebAssembly<\/code>\u5316\u3059\u308b\u3068\u3053\u308d\u307e\u3067\u6210\u529f\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u4e00\u70b9\u5927\u304d\u306a\u30c7\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308b\u3053\u3068\u306b\u6c17\u304c\u4ed8\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u304c\u3001\u300c<strong>\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba<\/strong>\u300d\u3067\u3057\u305f\u3002<\/p>\n<p><code>Go<\/code>\u3067\u4f5c\u3063\u305f<code>WebAssembly<\/code>\u306f\u4eca\u56de\u306e\u3088\u3046\u306a\u30b7\u30f3\u30d7\u30eb\u306a\u30b3\u30fc\u30c9\u3060\u3051\u3067\u3082\uff12MB\u3050\u3089\u3044\u306e\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3067\u306f\u6700\u5927\u306e\u76ee\u7684\u300c\u9ad8\u901f\u5316\u300d\u306e\u305f\u3081\u306b\u3001\u9577\u3044\u30ed\u30fc\u30c9\u6642\u9593\u304c\u767a\u751f\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u3001\u300c<strong>\u51b7\u305f\u3044\u30c9\u30ea\u30f3\u30af\u3092\u8cb7\u3046\u305f\u3081\u306b\u3001\u6c57\u304b\u3044\u3066\u9060\u304f\u307e\u3067\u6b69\u3044\u3066\u3044\u304f\ud83d\ude02<\/strong>\u300d\u3088\u3046\u306a\u72b6\u614b\u306b\u306a\u308b\u305f\u3081\u3001\u4eca\u56de\u306f\u898b\u9001\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u305f\u3060\u3001<code>Go<\/code>\u306f\u3053\u308c\u304b\u3089\u306e\u30e1\u30a4\u30f3\u30b9\u30c8\u30ea\u30fc\u30e0\u306b\u306a\u308b\u3060\u308d\u3046\u3068\u8a00\u308f\u308c\u308b\u7523\u696d\u306e\u4f1a\u793e\u304c\u591a\u304f\u63a1\u7528\u3057\u3066\u308b\u3068\u306e\u3053\u3068\u3067\uff08<code>Youtuber<\/code>\u3067\u3082\u3042\u308b<a href=\"https:\/\/www.youtube.com\/c\/%E3%82%B7%E3%83%AA%E3%82%A8%E3%83%B3%E6%88%A6%E9%9A%8AJUNTV\/featured\" target=\"_blank\" rel=\"noopener\">\u9152\u4e95\u6f64\u3055\u3093<\/a>\u304c\u52d5\u753b\u5185\u3067\u304a\u3063\u3057\u3083\u3063\u3066\u307e\u3057\u305f\uff09\u3001\u307e\u305f\u5225\u306e\u90e8\u5206\u3067\u6ce8\u76ee\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u3082\u8a66\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u2757<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9238\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/06\/no_4.png\" alt=\"\" width=\"318\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/06\/no_4.png 318w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/06\/no_4-298x300.png 298w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/06\/no_4-150x150.png 150w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/06\/no_4-100x100.png 100w\" sizes=\"auto, (max-width: 318px) 100vw, 318px\" \/><br \/>\n\u300c\u30b3\u30fc\u30d2\u30fc\u98f2\u3080\u3068<br \/>\n\u6c17\u5206\u60aa\u304f\u306a\u308b\u3088\u3046\u306b<br \/>\n\u306a\u3063\u3061\u3083\u3044\u307e\u3057\u305f<br \/>\n\uff08\u98f2\u307f\u3059\u304e\u2026\ud83d\udca6\uff09\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u79c1\u306e\u958b\u767a\u30e1\u30a4\u30f3\u306fPHP\uff08Laravel\uff09+ JavaScript\uff08Vue.js\uff09\u3067\u3001\u3082\u3057\u3053\u308c\u3089\u306b\u4e0d\u5411\u304d\u306a\u90e8\u5206\u304c\u3042\u308c\u3070Python\u3092\u4f7f\u3046\u3068\u3044\u3046\u5f62\u306b\u306a\u3063\u3066 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=9376\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;WebAssembly \u3092 Rust \u3067\u3064\u304f\u308a\u3001JavaScript \u3067\u3064\u304b\u3046&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":9385,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,237],"tags":[200],"class_list":["post-9376","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","category-rust","tag-webassembly"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/9376","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9376"}],"version-history":[{"count":7,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/9376\/revisions"}],"predecessor-version":[{"id":9388,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/9376\/revisions\/9388"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/9385"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9376"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}