Skip to content

Instantly share code, notes, and snippets.

use fluence::sdk::*;
#[invocation_handler]
fn greeting(name: String) -> String {
format!("Hello, world! From user {}", name)
}
use fluence::sdk::*;
#[invocation_handler]
fn greeting(name: String) -> String {
format!("Hello, world! From user {}", name)
}
[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"
[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"
#[no_mangle]
pub unsafe fn invoke(ptr: *mut u8, len: usize) -> usize {
...
}
#[no_mangle]
pub unsafe fn allocate(size: usize) -> NonNull<u8> {
...
}
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);
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());
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());
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)
}
#![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() {}