Expand description
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;
}
Modules§
- internal
- These API functions are intended for internal usage in generated code. Normally, you shouldn’t use them.
Macros§
Structs§
- Call
Parameters - This struct contains parameters that would be accessible by Wasm modules.
- Mounted
Binary Result - Describes result of calling a CLI service.
- Mounted
Binary String Result - The same as the MountedBinaryResult, but stdout and stderr are utf8 strings.
- Security
Tetraplet - Describes an origin that set an argument.
- Wasm
Logger Builder - The Wasm logger builder.
Constants§
Functions§
Type Aliases§
- Target
Map - Mapping from logging namespace string to its bitmask. TODO: use i64 for bitmask when wasmpack/bindgen issue with i64 is fixed. Currently, i64 doesn’t work on some versions of V8 because log_utf8_string function isn’t marked as #[wasm_bindgen]. In result, TS/JS code throws ‘TypeError’ on every log.