#fluence #sdk #webassembly

fluence

Fluence backend SDK for developing backend applications for the Fluence network

43 releases (5 breaking)

0.6.9 May 19, 2021
0.6.2 Apr 28, 2021
0.5.0 Mar 12, 2021
0.2.14 Dec 31, 2020
0.1.4 Mar 27, 2019

#2411 in Magic Beans

Download history 46/week @ 2022-11-28 43/week @ 2022-12-05 53/week @ 2022-12-12 47/week @ 2022-12-19 28/week @ 2022-12-26 21/week @ 2023-01-02 35/week @ 2023-01-09 18/week @ 2023-01-16 104/week @ 2023-01-23 82/week @ 2023-01-30 194/week @ 2023-02-06 230/week @ 2023-02-13 214/week @ 2023-02-20 14/week @ 2023-02-27 47/week @ 2023-03-06 16/week @ 2023-03-13

310 downloads per month
Used in 8 crates (4 directly)

Apache-2.0

36KB
546 lines

crates.io version

Marine Rust SDK

This SDK is intended to run backend application on the Fluence network with Marine runtime. 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 #[marine] that could be applied to a function, structure or extern block.

Structures with #[marine] (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::marine;

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

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

use fluence::marine;

#[marine]
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::marine;

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

Dependencies

~2.2–3MB
~65K SLoC