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
use fluence::sdk::*; | |
#[invocation_handler] | |
fn greeting(name: String) -> String { | |
format!("Hello, world! From user {}", 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
use fluence::sdk::*; | |
#[invocation_handler] | |
fn greeting(name: String) -> String { | |
format!("Hello, world! From user {}", 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
[package] | |
name = "hello_world2_2018" | |
version = "0.1.0" | |
authors = ["Fluence Labs"] | |
publish = false | |
description = "Just a demo application for Fluence with logging ability based on Rust 2015 edition" | |
edition = "2018" | |
[lib] | |
name = "hello_world2_2018" |
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 = "hello_world2_2018" | |
version = "0.1.0" | |
authors = ["Fluence Labs"] | |
publish = false | |
description = "Just a demo application for Fluence with logging ability based on Rust 2015 edition" | |
edition = "2018" | |
[lib] | |
name = "hello_world2_2018" |
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
#[no_mangle] | |
pub unsafe fn invoke(ptr: *mut u8, len: usize) -> usize { | |
... | |
} | |
#[no_mangle] | |
pub unsafe fn allocate(size: usize) -> NonNull<u8> { | |
... | |
} |
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
use fluence::sdk::*; | |
use log::info; | |
fn init() { | |
logger::WasmLogger::init_with_level(log::Level::Info).unwrap(); | |
} | |
#[invocation_handler(init_fn = init)] | |
fn greeting(name: String) -> String { | |
info!("{} has been successfully greeted", 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
use fluence::sdk::*; | |
use log::info; | |
fn init() { | |
logger::WasmLogger::init_with_level(log::Level::Info).unwrap(); | |
} | |
#[invocation_handler(init_fn = init, side_modules = (sqlite, redis))] | |
fn greeting(name: String) -> String { | |
redis::call("SET A hello".as_bytes()); |
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
use fluence::sdk::*; | |
use log::info; | |
fn init() { | |
logger::WasmLogger::init_with_level(log::Level::Info).unwrap(); | |
} | |
#[invocation_handler(init_fn = init, side_modules = (sqlite, redis))] | |
fn greeting(name: String) -> String { | |
redis::call("SET A hello".as_bytes()); |
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
use fluence::sdk::*; | |
fn init() {} | |
#[invocation_handler(init_fn = init, side_modules = (sqlite, redis))] | |
fn greeting(name: String) -> String { | |
let tt = redis::call("".as_bytes()); | |
let tt = sqlite::call("".as_bytes()); | |
format!("Hello, world! From user {}", 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
#![feature(prelude_import)] | |
#![no_std] | |
//! A simple demo application for Fluence. | |
#[prelude_import] | |
use std::prelude::v1::*; | |
#[macro_use] | |
extern crate std as std; | |
use fluence::sdk::*; | |
mod tt { | |
fn foo() {} |