output args separated with comma

This commit is contained in:
vms 2020-09-16 13:46:38 +03:00
parent 04ffc3dcf8
commit 3785c002b7
5 changed files with 22 additions and 13 deletions

6
Cargo.lock generated
View File

@ -675,7 +675,7 @@ dependencies = [
[[package]]
name = "fluence-app-service"
version = "0.1.4"
version = "0.1.5"
dependencies = [
"fluence-faas",
"log",
@ -686,7 +686,7 @@ dependencies = [
[[package]]
name = "fluence-faas"
version = "0.1.4"
version = "0.1.5"
dependencies = [
"cmd_lib",
"env_logger 0.7.1",
@ -794,7 +794,7 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]]
name = "frepl"
version = "0.1.7"
version = "0.1.8"
dependencies = [
"anyhow",
"clap",

View File

@ -1,13 +1,13 @@
[package]
name = "fluence-app-service"
description = "Fluence Application Service"
version = "0.1.4"
version = "0.1.5"
authors = ["Fluence Labs"]
license = "Apache-2.0"
edition = "2018"
[dependencies]
fluence-faas = { path = "../fluence-faas", version = "0.1.4" }
fluence-faas = { path = "../fluence-faas", version = "0.1.5" }
log = "0.4.8"
serde_json = "1.0.53"

View File

@ -1,7 +1,7 @@
[package]
name = "fluence-faas"
description = "Fluence FaaS"
version = "0.1.4"
version = "0.1.5"
authors = ["Fluence Labs"]
license = "Apache-2.0"
edition = "2018"

View File

@ -23,6 +23,7 @@ use serde::Serializer;
use std::fmt;
use std::collections::HashMap;
use itertools::Itertools;
#[derive(Debug, PartialEq, Clone)]
pub struct FaaSInterface<'a> {
@ -69,13 +70,21 @@ impl<'a> fmt::Display for FaaSInterface<'a> {
for (name, signature) in functions.iter() {
write!(f, " pub fn {}(", name)?;
for arg in signature.arguments {
write!(f, "{}: {}", arg.name, type_text_view(&arg.ty))?;
}
let args = signature
.arguments
.iter()
.map(|arg| format!("{}: {}", arg.name, type_text_view(&arg.ty)))
.join(", ");
if signature.output_types.is_empty() {
writeln!(f, ")")?;
writeln!(f, "{})", args)?;
} else if signature.output_types.len() == 1 {
writeln!(f, ") -> {}", type_text_view(&signature.output_types[0]))?;
writeln!(
f,
"{}) -> {}",
args,
type_text_view(&signature.output_types[0])
)?;
} else {
// At now, multi values aren't supported - only one output type is possible
unimplemented!()

View File

@ -1,7 +1,7 @@
[package]
name = "frepl"
description = "Fluence FCE REPL intended for testing purposes"
version = "0.1.7"
version = "0.1.8"
authors = ["Fluence Labs"]
repository = "https://github.com/fluencelabs/fce/tools/repl"
license = "Apache-2.0"
@ -12,7 +12,7 @@ name = "fce-repl"
path = "src/main.rs"
[dependencies]
fluence-app-service = { path = "../../fluence-app-service", version = "0.1.4", features = ["raw-module-api"] }
fluence-app-service = { path = "../../fluence-app-service", version = "0.1.5", features = ["raw-module-api"] }
anyhow = "1.0.31"
clap = "2.33.1"