Using Rust to Create an EDJX Serverless Function
Download the latest version of Rust.
Rust requires a C linker to be present on the system. On most Linux distributions, you need to have the gcc package installed.
Open a terminal instance on your system.
Navigate to the
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.
By default, the .wasm file is built and saved under the
<function-name>/target/wasm32-unknown-unknown/release directory with the following file structure.
Project Directory Name
|-- src |-- lib.rs |-- serverless-function.rs |-- target |-- wasm32-unknown-unknown |-- release |-- <function>.wasm |-- Cargo.lock |-- Cargo.toml |-- edjconfig.yaml |-- LICENSE |-- README.md