This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod utils; | |
use wasm_bindgen::prelude::*; | |
use serde::*; | |
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global | |
// allocator. | |
#[cfg(feature = "wee_alloc")] | |
#[global_allocator] | |
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "rust-fn" | |
version = "0.1.0" | |
authors = ["Ewan Slater <[email protected]>"] | |
edition = "2018" | |
[lib] | |
crate-type = ["cdylib", "rlib"] | |
[features] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "hellofn", | |
"version": "1.0.0", | |
"description": "example function", | |
"main": "func.js", | |
"author": "", | |
"license": "Apache-2.0", | |
"dependencies": { | |
"@fnproject/fdk": ">=0.0.18", | |
"@crush-157/rust-fn": ">=0.1.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fdk=require('@fnproject/fdk'); | |
const wasm=require('@crush-157/rust-fn'); | |
fdk.handle(function(input){ | |
let name = 'World'; | |
if (input.name) { | |
name = input.name; | |
} | |
return {'message': wasm.hello_string(name) } | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fdk=require('@fnproject/fdk'); | |
const wasm=require('@crush-157/rust-fn'); | |
fdk.handle(function(input){ | |
return wasm.hello_json(input); | |
}) |
OlderNewer