#+title: Building Spin components in Rust #+date:[2023-11-21 Tue] #+author: HaQadosch #+startup: indent #+note: based on https://developer.fermyon.com/spin/v2/rust-components * Org shortcuts ** Footnotes - create footnote :: ~C-c C-x f~ - jump to the footnote ref :: ~C-c C-c~ * Prerequisites Make sure you have all the *templates* #+name: check templates #+begin_src shell spin templates install --git https://github.com/fermyon/spin --update #+end_src #+RESULTS: check templates : Copying remote template source : Installing template http-zig... : Installing template redis-rust... : Installing template http-empty... : Installing template redis-go... : Installing template http-rust... : Installing template http-grain... : Installing template http-c... : Installing template http-go... : Installing template http-php... : Installing template static-fileserver... : Installing template http-swift... : Installing template redirect... : Installed 12 template(s) : : +------------------------------------------------------------------------+ : | Name Description | : +========================================================================+ : | http-c HTTP request handler using C and the Zig toolchain | : | http-empty HTTP application with no components | : | http-go HTTP request handler using (Tiny)Go | : | http-grain HTTP request handler using Grain | : | http-php HTTP request handler using PHP | : | http-rust HTTP request handler using Rust | : | http-swift HTTP request handler using SwiftWasm | : | http-zig HTTP request handler using Zig | : | redirect Redirects a HTTP route | : | redis-go Redis message handler using (Tiny)Go | : | redis-rust Redis message handler using Rust | : | static-fileserver Serves static files from an asset directory | : +------------------------------------------------------------------------+ Spin component need ~wasm32-wasi~ target for *Rust* #+name: target for Rust #+begin_src shell rustup target add wasm32-wasi #+end_src #+RESULTS: target for Rust : info: component 'rust-std' for target 'wasm32-wasi' is up to date * HTTP Components