| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
The rust supports sequence action by default, test steps as below
extern crate serde_json;
use serde_derive::{Deserialize, Serialize};
use serde_json::{Error, Value};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
struct Input {
#[serde(default = "stranger")]
name: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
struct Output {
greeting: String,
}
fn stranger() -> String {
"stranger".to_string()
}
pub fn main(args: Value) -> Result<Value, Error> {
// has no split, just return array, need to receive this value in next action(sort)
let output = ["a", "b"];
serde_json::to_value(output)
}
extern crate serde_json;
use serde_derive::{Deserialize, Serialize};
use serde_json::{Error, Value};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
struct Input {
#[serde(default = "stranger")]
name: String,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
struct Output {
greeting: String,
}
fn stranger() -> String {
"stranger".to_string()
}
pub fn main(args: Value) -> Result<Value, Error> {
println!("param args is {}", args);
let inputParam = args.as_array();
println!("input param as array is {:?}", inputParam);
let defaultOutput = ["finally-a", "finally-b"];
match inputParam {
None => serde_json::to_value(defaultOutput),
Some(x) => serde_json::to_value(x),
}
}
wsk -i action create /whisk.system/utils/split-rust --kind rust:1.34 ~/split.rs
wsk -i action create /whisk.system/utils/sort-rust --kind rust:1.34 ~/sort.rs
wsk -i action create mySequence-rust --sequence /whisk.system/utils/split-rust,/whisk.system/utils/sort-rust
wsk -i action invoke --result mySequence-rust -r -vrefer to: https://docs.serde.rs/serde_json/value/enum.Value.html |
Sorry, something went wrong.
|
|
||
| # select the builder to use | ||
| ARG GO_PROXY_BUILD_FROM=release | ||
| ARG GO_PROXY_BUILD_FROM=source |
There was a problem hiding this comment.
Need to change it to release due to apache/openwhisk-runtime-java#140 (comment)
Sorry, something went wrong.
There was a problem hiding this comment.
Already changed to release
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Depend on below prs:
Support array result for common action and sequence action openwhisk#5290
Support array result include sequence action openwhisk-runtime-go#170
Support array result