Create a .wasm File Written in Rust
To create .wasm files written in Rust you must have the EDJX Rust SDK installed on your environment.
To install the required SDK:
-
Download the latest version of Rust.
-
Install the Rust WASM target.
rustup target add wasm32-unknown-unknown
-
Clone the EDJX Rust Example code repo repository from GitHub to your environment.
This repository contains samples to help you build Rust serverless functions. The functions can then be built and deployed to the EDJX peer-to-peer network using the EDJX Console, CLI, or VS Code Extension.
See the README.md files in the EDJX GitHub repository from advanced installation options. |
To create, build, and deploy EDJX functions written in Rust:
-
Create a function:
-
Console - Create Function
-
CLI - function init command
-
VS Code - Add a Function
-
-
Build the function:
-
Console - Create Function
-
CLI - function build command
-
VS Code - Build a Function
See also Add a Function and Deploy a Function.
By default, the .wasm file is built and saved under thehost/<username>/<function-name>/target/wasm32-unknown-unknown/release
directory with the following file structure.
Project Directory Name|-- src |-- lib.rs |-- serverless-function.rs |-- Cargo.lock |-- Cargo.toml |-- edjconfig.yaml |-- LICENSE |-- README.md
-
-
Deploy the function:
-
Console - Create Function
-
CLI - function deploy command
-
VS Code - Deploy a Function
-