14 releases

0.6.15 Nov 2, 2021
0.6.14 Oct 7, 2021
0.6.13 Sep 28, 2021
0.6.11 Aug 13, 2021
0.6.9 May 19, 2021

#365 in WebAssembly

Download history 175/week @ 2021-08-08 246/week @ 2021-08-15 365/week @ 2021-08-22 168/week @ 2021-08-29 137/week @ 2021-09-05 163/week @ 2021-09-12 268/week @ 2021-09-19 299/week @ 2021-09-26 218/week @ 2021-10-03 261/week @ 2021-10-10 101/week @ 2021-10-17 62/week @ 2021-10-24 169/week @ 2021-10-31 235/week @ 2021-11-07 96/week @ 2021-11-14 153/week @ 2021-11-21

862 downloads per month
Used in 23 crates (4 directly)

Apache-2.0

140KB
3K SLoC

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:

Defines the #[marine] macro that should be used with all export functions, extern blocks. At now, It supports the following types that could be used as parameters in export or foreign functions: i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, bool, String, Vec. Also struct where all fields are public and have aforementioned types could be used as parameters. In this case #[marine] should be also applied to this structs.

Examples

This example shows how a function could be exported:

#[marine]
pub fn greeting(name: String) -> String {
    format!("Hi {}", name)
}

This more complex example shows how a function could be imported from another Wasm module and how a struct could be passed:

use marine_rs_sdk::MountedBinaryResult;

#[marine]
pub fn read_ipfs_file(file_path: String) -> MountedBinaryResult {
    let hash = calculate_hash(file_path);
    ipfs(vec![hash])
}

#[marine]
#[link(wasm_import_module = "ipfs_node")]
extern "C" {
    pub fn ipfs(file_hash: Vec<String>) -> MountedBinaryResult;
}

Dependencies

~1.1–2MB
~43K SLoC

a