update greeting with bool

This commit is contained in:
boneyard93501 2021-04-11 13:15:51 -05:00
parent 2333ded73b
commit 8950cd36d0
3 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,6 @@
modules_dir = "artifacts/"
[[module]]
name = "echo-service"
name = "greeting"
mem_pages_count = 1
logger_enabled = false

View File

@ -5,5 +5,5 @@ mkdir -p artifacts
cargo update
fce build --release
rm artifacts/*
rm -f artifacts/*.wasm
cp target/wasm32-wasi/release/greeting.wasm artifacts/

View File

@ -22,6 +22,9 @@ module_manifest!();
pub fn main() {}
#[fce]
pub fn greeting(name: String) -> String {
format!("Hi, {}", name)
pub fn greeting(name: String, greeter: bool) -> String {
match greeter {
true => format!("Hi, {}", name),
false => format!("Bye, {}", name),
}
}