SingleStoreDB’s new Code Engine — Powered by Wasm empowers users to utilize user-defined functions and table-valued functions written in C, C++ and Rust with more supported languages on the way. This is a quick guide on how to get started using this feature on SingleStoreDB with a local Rust environment!
WebAssembly (or Wasm for short), is a binary instruction format designed as a portable compilation target for programming languages. With SingleStoreDB’s Code Engine — Powered by Wasm, users can take advantage of reusing native code in a sandboxed environment, while running the function all inside a SingleStoreDB Workspace at blazing speeds.
I’ll demo how to get started creating Wasm files locally with Rust and VS Code, and then we will upload the files into an AWS S3 Bucket and load/call the Rust user-defined functions on a SingleStoreDB Cloud workspace.
Let’s start with our local Installs:
Install v.s. code. The download link can be found here

Download the WASI SDK (in this case we used wasi-sdk-16.0-macos.tar.gz for Mac)

Extract the WASI SDK file from your Downloads folder
tar -xzvf wasi-sdk-16.0-macos.tar.gz

Move the WASI SDK file in the folder of your choice (in my case, I placed it in the opt folder)

Ensure that your $PATH variable is prefixed with this location when you are running the build commands suggested in this tutorial
export PATH=/opt/wasi-sdk-16.0/bin:$PATH

Download and install the Rust toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

At the prompt, select option 1