#fluence #sdk #webassembly

fluence

Fluence backend SDK for developing backend applications for the Fluence network

37 releases (5 breaking)

new 0.6.2 Apr 28, 2021
0.5.0 Mar 12, 2021
0.2.14 Dec 31, 2020
0.2.9 Nov 8, 2020
0.1.4 Mar 27, 2019

#30 in WebAssembly

Download history 255/week @ 2021-01-12 147/week @ 2021-01-19 139/week @ 2021-01-26 165/week @ 2021-02-02 221/week @ 2021-02-09 406/week @ 2021-02-16 260/week @ 2021-02-23 152/week @ 2021-03-02 215/week @ 2021-03-09 174/week @ 2021-03-16 226/week @ 2021-03-23 127/week @ 2021-03-30 146/week @ 2021-04-06 253/week @ 2021-04-13 166/week @ 2021-04-20 235/week @ 2021-04-27

883 downloads per month
Used in 10 crates (5 directly)

Apache-2.0

36KB
548 lines

crates.io version

Rust backend SDK

This SDK intended to run backend application on the Fluence network. More information about usage and some internals could found in docs.


lib.rs:

Rust backend SDK for applications on the Fluence network. This crate defines the procedure macro #[fce] that could be applied to a function, structure or extern block.

Structures with #[fce] (hereinafter they'll be called records) could be used then in function arguments and values. All fields of a record should be public and have one of the following primitive Rust types (bool, u8, u16, u32, u64, i8, i16, i32, i64, f32, f64, String, Vec<u8>).

use fluence::fce;

#[fce]
struct T {
    pub field_1: i32,
    pub field_2: Vec<u8>,
}

Functions with #[fce] will be exported from this module:

use fluence::fce;

#[fce]
pub fn get(url: String) {
    // ...
}

At now, such functions could have arguments with primitive Rust types and record and only one return argument with such type could be used.

Finally, to import other wasm modules to your project use similar code:

use fluence::fce;

#[fce]
#[link(wasm_import_module = "wasm_curl.wasm")]
extern "C" {
    #[link_name = "get"]
    pub fn curl_get(url: String) -> String;
}

Dependencies

~1.8–2.7MB
~55K SLoC