Skip to content

Commit eaa26f0

Browse files
committed
hello demo working
1 parent 253b03a commit eaa26f0

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
# incubator-openwhisk-runtime-rust
22

3-
Work in Progress! Do not use...
3+
Work in Progress! Do not use yet...
4+
5+
6+
# Work Done
7+
8+
- implemented the actionloop
9+
- implemented the Docker image
10+
- implemented the action compiler
11+
12+
# Work to do
13+
14+
- Add the gradle build
15+
- Implement the mandatory scala tests
16+
- Submit and add to the list of supported runtimes

example/hello/src/lib.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ extern crate serde_json;
33
use std::collections::HashMap;
44
use serde_json::Value;
55

6-
pub fn main(mut input_data: HashMap<String, Value>) -> HashMap<String, Value> {
7-
input_data.insert("hello".to_string(),Value::String("world".to_string()));
8-
input_data
6+
pub fn main(args: HashMap<String, Value>) -> HashMap<String, Value> {
7+
let name_opt = args.get("name");
8+
let name = if name_opt.is_some() {
9+
name_opt.unwrap().as_str().unwrap()
10+
} else {
11+
"stranger"
12+
};
13+
let mut out = HashMap::new();
14+
out.insert("greeting".to_string(), Value::String(format!("Hello, {}", name)));
15+
out
916
}

rust1.32/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
USER?=openwhisk
1+
USER=docker.io/actionloop
22
IMAGE=actionloop-rust-v1.32
33

44
.PHONY: build
@@ -9,4 +9,7 @@ build:
99
devel: build
1010
docker run -ti -p 8080:8080 --entrypoint=bash \
1111
-v $(PWD):/mnt -e OW_COMPILER=/mnt/compile \
12-
$(USER)/$(IMAGE)
12+
13+
push: build
14+
docker login
15+
docker push $(USER)/$(IMAGE)

0 commit comments

Comments
 (0)