#fluence #marine #sdk #webassembly

marine-rs-sdk

Fluence backend SDK for developing backend applications for the Fluence network

9 releases

0.7.1 Sep 8, 2022
0.7.0 Jul 27, 2022
0.6.15 Nov 2, 2021
0.6.14 Oct 7, 2021
0.6.10 Jun 15, 2021

#860 in Magic Beans

Download history 505/week @ 2023-02-02 433/week @ 2023-02-09 585/week @ 2023-02-16 644/week @ 2023-02-23 318/week @ 2023-03-02 348/week @ 2023-03-09 566/week @ 2023-03-16 520/week @ 2023-03-23 343/week @ 2023-03-30 570/week @ 2023-04-06 407/week @ 2023-04-13 333/week @ 2023-04-20 378/week @ 2023-04-27 253/week @ 2023-05-04 242/week @ 2023-05-11 111/week @ 2023-05-18

1,033 downloads per month
Used in 16 crates (7 directly)

Apache-2.0

39KB
558 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 marine_rs_sdk::marine;

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

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

use marine_rs_sdk::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 marine_rs_sdk::marine;

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

Dependencies

~1.8–2.8MB
~57K SLoC