Easegress Rust SDK
This is the Rust SDK for Easegress. It can be used to extend the ability of Easegress.
Prerequisites
The following steps assume that Git and Rust are installed.
Local Development
- Clone the repo.
- Implement your extension in
src/lib.rs. Please check theexamplesdirectory for more examples.
use HashMap;
use Duration;
use *;
use easegress_object;
// define your own struct.
;
// implement Program trait for your own struct.
Note
- You need to implement the
Programtrait on your own struct. - Additionally, the
#[easegress_object]attribute macro must be applied to both your struct definition and the trait impl block for it. - Only one struct with
#[easegress_object]attribute macro is allowed.
- Add
wasm32-unknown-unknowntarget.
- Build with this command
If success, it will generate easegress_demo.wasm at the target/wasm32-unknown-unknown/release folder.
Deploy and execute
Please refer to the documentation of WasmHost for deploying and executing the compiled Wasm code.